-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathNetworkRow.tsx
More file actions
70 lines (66 loc) · 2.5 KB
/
NetworkRow.tsx
File metadata and controls
70 lines (66 loc) · 2.5 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
68
69
70
import { motion } from 'framer-motion'
import { memo } from 'react'
import { ButtonOrLink, ExperimentalCopyButton, Skeleton } from '@edgeandnode/gds'
import { Check } from '@edgeandnode/gds/icons'
import { NetworkIcon } from '@edgeandnode/go'
import { getIconVariant, shouldShowSkeleton } from '@/supportedNetworks/utils'
interface NetworkRowProps {
network: {
id: string
shortName: string
caip2Id: string
subgraphs: boolean
substreams: boolean
firehose: boolean
tokenapi: boolean
}
locale: string
}
export const NetworkRow = memo(({ network, locale }: NetworkRowProps) => {
return (
<motion.tr
className="group/table-row isolate -outline-offset-1 transition hocus-visible-within:bg-space-1600 has-[a:focus-visible]:outline-focus"
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
exit={{
opacity: 0,
y: -16,
transition: {
duration: 0.1,
ease: 'easeIn',
},
}}
transition={{
duration: 0.2,
ease: 'easeOut',
}}
layoutId={network.id}
>
<td>
<ButtonOrLink href={`/${locale}/supported-networks/${network.id}`} className="static outline-none">
<span className="flex items-center gap-2">
{shouldShowSkeleton(network.id) ? (
<Skeleton borderRadius="FULL" height="20px" width="20px" />
) : (
<NetworkIcon variant={getIconVariant(network.id)} caip2Id={network.caip2Id as any} size={5} />
)}
<span className="text-body-xsmall">{network.shortName}</span>
</span>
<span className="absolute inset-y-0 start-0 z-10 w-[1999px]" />
</ButtonOrLink>
</td>
<td>
<div className="flex items-center justify-between gap-2">
<span className="text-body-xsmall">{network.id}</span>
<div className="z-20 shrink-0 opacity-0 transition group-focus-within/table-row:opacity-100 group-hover/table-row:opacity-100">
<ExperimentalCopyButton size="small" variant="tertiary" value={network.id} />
</div>
</div>
</td>
<td align="center">{network.subgraphs ? <Check size={4} alt="Checkmark" /> : null}</td>
<td align="center">{network.substreams ? <Check size={4} alt="Checkmark" /> : null}</td>
<td align="center">{network.firehose ? <Check size={4} alt="Checkmark" /> : null}</td>
<td align="center">{network.tokenapi ? <Check size={4} alt="Checkmark" /> : null}</td>
</motion.tr>
)
})