Skip to content

Commit a76ba5f

Browse files
authored
Add truncation component to prevent table breakage (#2503)
1 parent 63475c6 commit a76ba5f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

app/components/DocsPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type DocsPopoverProps = {
4444
export const DocsPopover = ({ heading, icon, summary, links }: DocsPopoverProps) => {
4545
return (
4646
<Popover>
47-
<PopoverButton className={cn(buttonStyle({ size: 'sm', variant: 'ghost' }), 'w-9')}>
47+
<PopoverButton className={cn(buttonStyle({ size: 'sm', variant: 'ghost' }), 'w-8')}>
4848
<Question12Icon aria-label="Links to docs" className="shrink-0" />
4949
</PopoverButton>
5050
<PopoverPanel

app/components/form/fields/DisksTableField.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type { InstanceCreateInput } from '~/forms/instance-create'
1616
import { Badge } from '~/ui/lib/Badge'
1717
import { Button } from '~/ui/lib/Button'
1818
import * as MiniTable from '~/ui/lib/MiniTable'
19+
import { Truncate } from '~/ui/lib/Truncate'
1920
import { bytesToGiB } from '~/util/units'
2021

2122
export type DiskTableItem =
@@ -60,7 +61,9 @@ export function DisksTableField({
6061
aria-label={`Name: ${item.name}, Type: ${item.type}`}
6162
key={item.name}
6263
>
63-
<MiniTable.Cell>{item.name}</MiniTable.Cell>
64+
<MiniTable.Cell>
65+
<Truncate text={item.name} maxLength={35} />
66+
</MiniTable.Cell>
6467
<MiniTable.Cell>
6568
<Badge variant="solid">{item.type}</Badge>
6669
</MiniTable.Cell>

app/ui/styles/components/mini-table.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030

3131
& td > div {
32-
@apply flex h-11 items-center border-y py-3 pl-3 text-accent bg-accent-secondary border-accent-tertiary;
32+
@apply flex h-11 items-center border-y py-3 pl-3 pr-6 text-accent bg-accent-secondary border-accent-tertiary;
3333
}
3434

3535
& td:last-child > div {

0 commit comments

Comments
 (0)