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
67 lines (65 loc) · 2.18 KB
/
Copy pathAdminDomainCard.js
File metadata and controls
67 lines (65 loc) · 2.18 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
64
65
66
67
import React from 'react'
import { Trans } from '@lingui/macro'
import { array, bool, string } from 'prop-types'
import { Flex, Grid, Link, ListItem, Stack, Tag, TagLabel, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@chakra-ui/icons'
import { ABTestVariant, ABTestingWrapper } from '../app/ABTestWrapper'
import { sanitizeUrl } from '../utilities/sanitizeUrl'
export function AdminDomainCard({ url, tags, isHidden, isArchived, ...rest }) {
return (
<ListItem {...rest}>
<Grid templateColumns={{ base: 'auto', md: '40% 60%' }} columnGap="1.5rem">
<Stack isInline align="center">
<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>
<Flex>
{tags?.map((tag, idx) => {
return (
<Tag key={idx} m="1" borderRadius="full" borderWidth="1px" borderColor="gray.900">
<TagLabel mx="auto">{tag}</TagLabel>
</Tag>
)
})}
<ABTestingWrapper insiderVariantName="B">
<ABTestVariant name="B">
{isHidden && (
<Tag m="1" borderRadius="full" borderWidth="1px" borderColor="gray.900">
<TagLabel mx="auto">
<Trans>Hidden</Trans>
</TagLabel>
</Tag>
)}
{isArchived && (
<Tag m="1" borderRadius="full" borderWidth="1px" borderColor="gray.900">
<TagLabel mx="auto">
<Trans>Archived</Trans>
</TagLabel>
</Tag>
)}
</ABTestVariant>
</ABTestingWrapper>
</Flex>
</Grid>
</ListItem>
)
}
AdminDomainCard.propTypes = {
url: string,
tags: array,
isHidden: bool,
isArchived: bool,
}