Skip to content

Commit 1fb746f

Browse files
Make links in tables more clearly clickable (#1899)
* All links are underlined * Make disk link match the others * Whole row hover * Make underline less noisy * Use `text-secondary` across the whole table by default * Fix bg overlapping border * Simpler fix * Equivalent...nicer * Might as well
1 parent ca7c85d commit 1fb746f

File tree

8 files changed

+28
-24
lines changed

8 files changed

+28
-24
lines changed

app/components/ExternalIps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function ExternalIps({ project, instance }: InstanceSelector) {
3939
function IpLink({ ip }: { ip: string }) {
4040
return (
4141
<a
42-
className="underline text-sans-semi-md text-secondary hover:text-default"
42+
className="link-with-underline text-sans-semi-md"
4343
href={`https://${ip}`}
4444
target="_blank"
4545
rel="noreferrer"

app/pages/project/disks/DisksPage.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
useApiQueryClient,
1717
type Disk,
1818
} from '@oxide/api'
19-
import { DateCell, SizeCell, useQueryTable, type MenuAction } from '@oxide/table'
19+
import { DateCell, linkCell, SizeCell, useQueryTable, type MenuAction } from '@oxide/table'
2020
import {
2121
buttonStyle,
2222
EmptyMessage,
@@ -43,14 +43,12 @@ function AttachedInstance({
4343
const { data: instance } = useApiQuery('instanceView', {
4444
path: { instance: instanceId },
4545
})
46-
return instance ? (
47-
<Link
48-
className="text-sans-semi-md text-accent hover:underline"
49-
to={pb.instancePage({ ...projectSelector, instance: instance.name })}
50-
>
51-
{instance.name}
52-
</Link>
53-
) : null
46+
47+
const instanceLinkCell = linkCell((instanceName) =>
48+
pb.instancePage({ ...projectSelector, instance: instanceName })
49+
)
50+
51+
return instance ? instanceLinkCell({ value: instance.name }) : null
5452
}
5553

5654
const EmptyState = () => (

app/pages/project/instances/instance/tabs/NetworkingTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const VpcNameFromId = ({ value }: { value: string }) => {
5858
if (!vpc) return <Skeleton />
5959
return (
6060
<Link
61-
className="underline text-sans-semi-md text-secondary hover:text-default"
61+
className="link-with-underline text-sans-semi-md"
6262
to={pb.vpc({ ...projectSelector, vpc: vpc.name })}
6363
>
6464
{vpc.name}

libs/table/cells/LinkCell.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ export const linkCell =
1414
({ value }: Cell<string>) => {
1515
return (
1616
<Link
17-
className="flex h-full w-full items-center text-sans-semi-md text-default hover:underline"
17+
className="link-with-underline group flex h-full w-full items-center text-sans-semi-md"
1818
to={makeHref(value)}
1919
>
20-
{value}
2120
{/* Pushes out the link area to the entire cell for improved clickability™ */}
22-
<div className="absolute inset-0" />
21+
<div className="absolute inset-0 right-px group-hover:bg-raise" />
22+
<div className="relative">{value}</div>
2323
</Link>
2424
)
2525
}

libs/ui/lib/date-picker/CalendarCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function CalendarCell({ state, date }: CalendarCellProps) {
8787
>
8888
<div
8989
className={cn(
90-
'pointer-events-none absolute bottom-[0] left-[1px] right-[1px] top-[0] rounded',
90+
'pointer-events-none absolute bottom-[0] left-px right-px top-[0] rounded',
9191
isSelectionStart || isSelectionEnd
9292
? isInvalid
9393
? 'border border-error-secondary'

libs/ui/lib/table/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Table.Cell = ({ height = 'large', className, children, ...props }: TableCellProp
112112
>
113113
<div
114114
className={cn(
115-
'-my-[1px] -mr-[2px] flex items-center border-b border-l py-3 pl-3 pr-3 border-secondary',
115+
'relative -my-[1px] -mr-[2px] flex items-center border-b border-l py-3 pl-3 pr-3 border-secondary',
116116
heightClass
117117
)}
118118
>

libs/ui/lib/table/table.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ table.ox-table {
3232
& td {
3333
min-width: fit-content;
3434
white-space: nowrap;
35+
@apply text-secondary;
3536
}
3637

3738
/*
@@ -45,7 +46,7 @@ table.ox-table {
4546
/* First column is sticky */
4647
& th:first-of-type,
4748
& td:first-of-type {
48-
@apply sticky left-0 bg-default;
49+
@apply sticky left-0 z-10 bg-default;
4950
}
5051

5152
/*
@@ -64,7 +65,7 @@ table.ox-table {
6465
Highlight when hovering over the action-col cell
6566
*/
6667
& td.action-col:hover > div {
67-
@apply bg-hover;
68+
@apply bg-raise;
6869
}
6970

7071
/*
@@ -75,7 +76,7 @@ table.ox-table {
7576
below with a background colour and still keep the styling
7677
*/
7778
& tr:last-of-type td:last-of-type.action-col {
78-
@apply border-b-0 border-r-0 !bg-default;
79+
@apply border-b-0 border-r-0;
7980
}
8081

8182
& tr:last-of-type td:last-of-type.action-col > div {

libs/ui/styles/index.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@
5151
}
5252

5353
@layer utilities {
54-
.dashed-underline {
55-
text-decoration: underline;
56-
text-decoration-style: dashed;
57-
}
58-
5954
.external-link {
6055
@apply text-accent-secondary hover:text-accent;
6156
}
@@ -65,6 +60,16 @@
6560
margin-left: var(--content-gutter);
6661
margin-right: var(--content-gutter);
6762
}
63+
64+
.link-with-underline {
65+
@apply text-secondary hover:text-default;
66+
text-decoration: underline;
67+
text-decoration-color: var(--content-quinary);
68+
69+
&:hover {
70+
text-decoration-color: var(--content-tertiary);
71+
}
72+
}
6873
}
6974

7075
@layer components {

0 commit comments

Comments
 (0)