Skip to content

Commit 20353f9

Browse files
committed
Work around Safari bug with absolute positioning relative to table row
1 parent 149c8f2 commit 20353f9

4 files changed

Lines changed: 22 additions & 32 deletions

File tree

website/src/components/Table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ export const Table = ({ className, children, variant = 'default', ...props }: Ta
1818
>
1919
<table
2020
className={`
21-
min-w-full
21+
h-max min-w-full overflow-clip
2222
${
2323
isSupportedNetworks
2424
? '-:nested-[td]:border-y -:nested-[td:not(:first-child)]:border-l -:nested-[td:not(:last-child)]:border-r -:nested-[td]:border-space-1500'
2525
: '-:nested-[th,td]:border -:nested-[th,td]:border-space-1500'
2626
}
2727
-:nested-[td:has(.highlight-cell)]:bg-purple-1200
28-
${isSupportedNetworks ? '-:nested-[th]:whitespace-nowrap' : '-:nested-[th]:whitespace-normal -:nested-[th]:bg-space-1700'}
28+
${isSupportedNetworks ? '-:nested-[th]:h-8 -:nested-[th]:whitespace-nowrap' : '-:nested-[th]:whitespace-normal -:nested-[th]:bg-space-1700'}
2929
-:nested-[tr:has(.highlight-row)_td]:bg-purple-1200
3030
-:nested-[th,td]:px-3.5
3131
-:nested-[th,td]:py-2.5
32-
${isSupportedNetworks ? '-:nested-[td]:align-middle' : '-:nested-[td]:align-top'}
32+
${isSupportedNetworks ? '-:nested-[td]:h-16 -:nested-[td]:align-middle' : '-:nested-[td]:align-top'}
3333
-:nested-[th]:font-medium
3434
mdx-[:is(p,ul,ol):not(:last-child,:is(ul,ol)_*)]:mb-3
3535
mdx-[ul,ol]:gap-1

website/src/supportedNetworks/components/NetworkRow.tsx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { motion } from 'framer-motion'
2-
import NextLink from 'next/link'
32
import { memo } from 'react'
43

5-
import { ExperimentalCopyButton, Skeleton } from '@edgeandnode/gds'
4+
import { ButtonOrLink, ExperimentalCopyButton, Skeleton } from '@edgeandnode/gds'
65
import { Check } from '@edgeandnode/gds/icons'
76
import { NetworkIcon } from '@edgeandnode/go'
87

@@ -24,7 +23,7 @@ interface NetworkRowProps {
2423
export const NetworkRow = memo(({ network, locale }: NetworkRowProps) => {
2524
return (
2625
<motion.tr
27-
className="group h-16 cursor-pointer transition-colors hover:bg-space-1600"
26+
className="group/table-row isolate -outline-offset-1 transition hocus-visible-within:bg-space-1600 has-[a:focus-visible]:outline-focus"
2827
initial={{ opacity: 0, y: 16 }}
2928
animate={{ opacity: 1, y: 0 }}
3029
exit={{
@@ -41,33 +40,24 @@ export const NetworkRow = memo(({ network, locale }: NetworkRowProps) => {
4140
}}
4241
layoutId={network.id}
4342
>
44-
<td className="static min-w-48">
45-
<NextLink
46-
href={`/${locale}/supported-networks/${network.id}`}
47-
className="absolute inset-0 z-10 flex size-full items-center px-3.5 py-2.5 -outline-offset-2"
48-
>
49-
<div className="flex items-center gap-2">
43+
<td>
44+
<ButtonOrLink href={`/${locale}/supported-networks/${network.id}`} className="static outline-none">
45+
<span className="flex items-center gap-2">
5046
{shouldShowSkeleton(network.id) ? (
5147
<Skeleton borderRadius="FULL" height="20px" width="20px" />
5248
) : (
5349
<NetworkIcon variant={getIconVariant(network.id)} caip2Id={network.caip2Id as any} size={5} />
5450
)}
55-
<span className="text-p14">{network.shortName}</span>
56-
</div>
57-
</NextLink>
51+
<span className="text-body-xsmall">{network.shortName}</span>
52+
</span>
53+
<span className="absolute inset-y-0 start-0 z-10 w-[1999px]" />
54+
</ButtonOrLink>
5855
</td>
59-
<td className="w-48">
60-
<div className="flex w-full items-center justify-between gap-2">
61-
<span className="text-p14 !mb-0">{network.id}</span>
62-
<div className="z-20 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100">
63-
<div
64-
onClick={(e) => {
65-
e.preventDefault()
66-
e.stopPropagation()
67-
}}
68-
>
69-
<ExperimentalCopyButton size="small" variant="tertiary" value={network.id} />
70-
</div>
56+
<td>
57+
<div className="flex items-center justify-between gap-2">
58+
<span className="text-body-xsmall">{network.id}</span>
59+
<div className="z-20 shrink-0 opacity-0 transition group-focus-within/table-row:opacity-100 group-hover/table-row:opacity-100">
60+
<ExperimentalCopyButton size="small" variant="tertiary" value={network.id} />
7161
</div>
7262
</div>
7363
</td>

website/src/supportedNetworks/components/NetworksTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export const NetworksTable = memo(({ networks, isLoading, locale }: NetworksTabl
2525
<Table variant="supported-networks">
2626
<tbody>
2727
<tr>
28-
<th className="w-48">
28+
<th className="min-w-46">
2929
<Text.C10>{t('index.supportedNetworks.tableHeaders.name')}</Text.C10>
3030
</th>
31-
<th className="w-48">
31+
<th className="min-w-46">
3232
<Text.C10>{t('index.supportedNetworks.tableHeaders.id')}</Text.C10>
3333
</th>
3434
<th align="center">

website/src/supportedNetworks/components/SkeletonRow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { Skeleton } from '@edgeandnode/gds'
44

55
export const SkeletonRow = memo(() => {
66
return (
7-
<tr className="h-16">
8-
<td className="w-48">
7+
<tr>
8+
<td>
99
<div className="flex items-center gap-2">
1010
<Skeleton borderRadius="FULL" height="20px" width="20px" />
1111
<Skeleton borderRadius="XS" height="12px" width="100px" />
1212
</div>
1313
</td>
14-
<td className="w-48">
14+
<td>
1515
<Skeleton borderRadius="XS" height="12px" width="80px" />
1616
</td>
1717
<td align="center">

0 commit comments

Comments
 (0)