forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminDomianCard.js
More file actions
56 lines (54 loc) · 1.64 KB
/
AdminDomianCard.js
File metadata and controls
56 lines (54 loc) · 1.64 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
import React from 'react'
import { Trans } from '@lingui/macro'
import { string } from 'prop-types'
import { Box, Grid, Link, ListItem, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon, LinkIcon } from '@chakra-ui/icons'
import { Link as RouteLink } from 'react-router-dom'
import { sanitizeUrl } from '../utilities/sanitizeUrl'
export function AdminDomianCard({ url, lastRan, ...rest }) {
return (
<ListItem {...rest}>
<Grid
templateColumns={{ base: 'auto', md: '40% 60%' }}
columnGap="1.5rem"
>
<Stack isInline>
<Text fontWeight="bold">
<Trans>Domain:</Trans>
</Text>
<Link
ml="auto"
// TODO: have the API enforce a scheme
// so we don't need to guess badly here.
href={`http://${sanitizeUrl(url)}`}
isExternal
target="_blank"
rel="noopener noreferrer"
>
{url}
<ExternalLinkIcon mx="2px" aria-hidden="true" />
</Link>
</Stack>
{lastRan && (
<Stack isInline>
<Text fontWeight="bold">
<Trans>Last scanned:</Trans>
</Text>
<Link ml="auto" as={RouteLink} to={`domains/${url}`}>
{lastRan}
<LinkIcon mx="2px" aria-hidden="true" />
</Link>
</Stack>
)}
{!lastRan && (
<Box>
<Text fontWeight="bold">
<Trans>Not scanned yet.</Trans>
</Text>
</Box>
)}
</Grid>
</ListItem>
)
}
AdminDomianCard.propTypes = { url: string, lastRan: string }