forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanCard.js
More file actions
59 lines (52 loc) · 1.55 KB
/
ScanCard.js
File metadata and controls
59 lines (52 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from 'react'
import { Box, Heading, Stack, Text } from '@chakra-ui/core'
import { object, string } from 'prop-types'
import ScanCategoryDetails from './ScanCategoryDetails'
import WithPseudoBox from './withPseudoBox'
import { t } from '@lingui/macro'
import { useLingui } from '@lingui/react'
function ScanCard({ scanType, scanData }) {
const { i18n } = useLingui()
const cardTitle =
scanType === 'web'
? i18n._(t`Web Scan Results`)
: scanType === 'email'
? i18n._(t`Email Scan Results`)
: ''
const cardDescription =
scanType === 'web'
? i18n._(t`Results for scans of web technologies (SSL, HTTPS).`)
: scanType === 'email'
? i18n._(t`Results for scans of email technologies (DMARC, SPF, DKIM).`)
: ''
const scanCategories = ['https', 'ssl', 'dmarc', 'spf', 'dkim']
const categoryList = Object.entries(scanData)
.filter(([categoryName, _categoryData]) =>
scanCategories.includes(categoryName),
)
.map(([categoryName, categoryData]) => {
return (
<ScanCategoryDetails
categoryName={categoryName}
categoryData={categoryData}
key={categoryName}
/>
)
})
return (
<Box bg="gray.200" py="2.5">
<Stack px="1">
<Heading as="h1" size="lg">
{cardTitle}
</Heading>
<Text>{cardDescription}</Text>
<Stack spacing="30px">{categoryList}</Stack>
</Stack>
</Box>
)
}
export default WithPseudoBox(ScanCard)
ScanCard.propTypes = {
scanType: string,
scanData: object,
}