Skip to content

Commit a25e84e

Browse files
authored
Small table cell refactor (#2166)
1 parent 629c94a commit a25e84e

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const VpcSubnetsTab = () => {
8181
{creating && <CreateSubnetForm onDismiss={() => setCreating(false)} />}
8282
{editing && <EditSubnetForm editing={editing} onDismiss={() => setEditing(null)} />}
8383
</div>
84-
<Table columns={columns} emptyState={emptyState} />
84+
<Table columns={columns} emptyState={emptyState} rowHeight="large" />
8585
</>
8686
)
8787
}

app/pages/system/inventory/sled/SledInstancesTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ export function SledInstancesTab() {
7878

7979
const columns = useColsWithActions(staticCols, makeActions)
8080

81-
return <Table columns={columns} emptyState={<EmptyState />} />
81+
return <Table columns={columns} emptyState={<EmptyState />} rowHeight="large" />
8282
}

app/ui/lib/Table.tsx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,24 @@ Table.Body = ({ className, children, ...props }: TableBodyProps) => {
9292
}
9393

9494
export type TableCellProps = JSX.IntrinsicElements['td'] & { height?: 'small' | 'large' }
95-
Table.Cell = ({ height = 'small', className, children, ...props }: TableCellProps) => {
96-
const heightClasses = { 'h-12': height === 'small', 'h-16': height === 'large' }
97-
return (
98-
<td
95+
Table.Cell = ({ height = 'small', className, children, ...props }: TableCellProps) => (
96+
<td
97+
className={cn(
98+
className,
99+
'pl-0 text-default border-default children:first:border-l-0 children:last:-mr-[1px]'
100+
)}
101+
{...props}
102+
>
103+
<div
99104
className={cn(
100-
className,
101-
'pl-0 text-default border-default children:first:border-l-0 children:last:-mr-[1px]',
102-
heightClasses
105+
'relative -my-[1px] -mr-[2px] flex items-center border-b border-l p-3 border-secondary',
106+
{ 'h-12': height === 'small', 'h-16': height === 'large' }
103107
)}
104-
{...props}
105108
>
106-
<div
107-
className={cn(
108-
'relative -my-[1px] -mr-[2px] flex items-center border-b border-l py-3 pl-3 pr-3 border-secondary',
109-
heightClasses
110-
)}
111-
>
112-
{children}
113-
</div>
114-
</td>
115-
)
116-
}
109+
{children}
110+
</div>
111+
</td>
112+
)
117113

118114
/**
119115
* Used _outside_ of the `Table`, this element wraps buttons that sit on top

0 commit comments

Comments
 (0)