forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDomainList.js
More file actions
31 lines (29 loc) · 801 Bytes
/
DomainList.js
File metadata and controls
31 lines (29 loc) · 801 Bytes
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
import React from 'react'
import { Trans } from '@lingui/macro'
import { List, ListItem } from '@chakra-ui/core'
import { string, arrayOf, func, shape, object } from 'prop-types'
export function DomainList({ domains = [], ...props }) {
const elements = []
if (!domains || (domains && domains.length === 0)) {
return (
<List {...props}>
<ListItem key={'no-domains-scanned'}>
<Trans>No domains scanned yet.</Trans>
</ListItem>
</List>
)
} else {
for (const domain of domains) {
elements.push(props.children(domain))
}
return <List {...props}>{elements}</List>
}
}
DomainList.propTypes = {
children: func,
domains: arrayOf(
shape({
node: shape({ organization: object, url: string, lastRan: string }),
}),
),
}