forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminDomainCard.js
More file actions
63 lines (61 loc) · 1.91 KB
/
AdminDomainCard.js
File metadata and controls
63 lines (61 loc) · 1.91 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
61
62
63
import React from 'react'
import { t, Trans } from '@lingui/macro'
import { array, bool, string } from 'prop-types'
import { Flex, ListItem, Tag, TagLabel, Text, Tooltip } from '@chakra-ui/react'
export function AdminDomainCard({ url, tags, assetState, isArchived, rcode, ...rest }) {
const assetStateLabels = {
APPROVED: t`Approved`,
DEPENDENCY: t`Dependency`,
MONITOR_ONLY: t`Monitor Only`,
CANDIDATE: t`Candidate`,
REQUIRES_INVESTIGATION: t`Requires Investigation`,
}
return (
<ListItem {...rest}>
<Flex align="center">
<Text minWidth="35%" fontWeight="bold" fontSize="lg" mr="2">
{url}
</Text>
<Flex>
{tags?.map(({ label, description }, idx) => {
return (
<Tag key={idx} mr="1" bg="gray.50" borderWidth="1px" borderColor="gray.900">
<Tooltip label={description} fontSize="md" placement="top">
<TagLabel textColor="primary" fontWeight="bold" mx="auto">
{label.toUpperCase()}
</TagLabel>
</Tooltip>
</Tag>
)
})}
</Flex>
<Flex ml="auto">
{assetState && (
<Tag colorScheme="blue" mx="1">
<TagLabel fontWeight="bold">{assetStateLabels[assetState]}</TagLabel>
</Tag>
)}
{rcode === 'NXDOMAIN' && (
<Tag colorScheme="red" mr="auto" alignSelf="center">
<TagLabel fontWeight="bold">NXDOMAIN</TagLabel>
</Tag>
)}
{isArchived && (
<Tag colorScheme="red" mx="1">
<TagLabel fontWeight="bold">
<Trans>ARCHIVED</Trans>
</TagLabel>
</Tag>
)}
</Flex>
</Flex>
</ListItem>
)
}
AdminDomainCard.propTypes = {
url: string,
tags: array,
isArchived: bool,
rcode: string,
assetState: string,
}