forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDomain.js
More file actions
60 lines (59 loc) · 1.55 KB
/
Domain.js
File metadata and controls
60 lines (59 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
60
import React from 'react'
import { Trans } from '@lingui/macro'
import { string } from 'prop-types'
import {
Divider,
Stack,
Box,
Link,
Icon,
Text,
ListItem,
} from '@chakra-ui/core'
import { sanitizeUrl } from './sanitizeUrl'
import { Link as RouteLink } from 'react-router-dom'
import { slugify } from './slugify'
export function Domain({ url, lastRan, ...rest }) {
return (
<ListItem {...rest}>
<Stack spacing={4} padding={[1, 2, 3]}>
<Stack isInline>
<Text fontWeight="bold">
<Trans>Domain:</Trans>
</Text>
<Link
// 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}
<Icon name="external-link" mx="2px" />
</Link>
</Stack>
{lastRan && (
<Stack isInline>
<Text fontWeight="bold">
<Trans>Last scanned:</Trans>
</Text>
<Link as={RouteLink} to={`domains/${slugify(url)}`}>
{lastRan}
<Icon name="link" mx="2px" />
</Link>
</Stack>
)}
{!lastRan && (
<Box>
<Text fontWeight="bold">
<Trans>Not scanned yet.</Trans>
</Text>
</Box>
)}
</Stack>
<Divider borderColor="gray.900" />
</ListItem>
)
}
Domain.propTypes = { url: string, lastRan: string }