Skip to content

Commit

Permalink
simplify layout
Browse files Browse the repository at this point in the history
  • Loading branch information
giogonzo committed Sep 21, 2023
1 parent d226958 commit 9c003fb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
78 changes: 39 additions & 39 deletions packages/bento-design-system/src/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,45 +424,45 @@ export function Table<
});

return (
<Box style={{ height: tableHeight(height) }} ref={tableContainerRef} overflow="auto">
<Box
{...getTableProps()}
alignItems="stretch"
className={table}
style={{
...getTableProps().style,
gridTemplateColumns,
height: virtualizeRows ? `${rowVirtualizer.getTotalSize()}px` : tableHeight(height),
}}
>
{headerGroups.map((headerGroup) =>
headerGroup.headers.map((header, index) => (
<ColumnHeader
column={header}
key={header.id}
style={{
...stickyLeftColumnStyle[header.id],
...assignInlineVars({
[stickyTopHeight]: header.columns ? "0" : `${stickyHeaderHeight}px`,
}),
}}
lastLeftSticky={
header.columns
? header.id === stickyLeftColumnGroupsIds.at(-1)
: index === lastStickyColumnIndex
}
stickyHeaders={stickyHeaders}
sticky={
stickyLeftColumnsIds.includes(header.id) ||
stickyLeftColumnGroupsIds.includes(header.id)
}
first={index === 0}
last={index + 1 === flatColumns.length}
/>
))
)}
{renderedRows}
</Box>
<Box
{...getTableProps()}
alignItems="stretch"
className={table}
style={{
...getTableProps().style,
gridTemplateColumns,
height: tableHeight(height),
}}
ref={tableContainerRef}
overflow="auto"
>
{headerGroups.map((headerGroup) =>
headerGroup.headers.map((header, index) => (
<ColumnHeader
column={header}
key={header.id}
style={{
...stickyLeftColumnStyle[header.id],
...assignInlineVars({
[stickyTopHeight]: header.columns ? "0" : `${stickyHeaderHeight}px`,
}),
}}
lastLeftSticky={
header.columns
? header.id === stickyLeftColumnGroupsIds.at(-1)
: index === lastStickyColumnIndex
}
stickyHeaders={stickyHeaders}
sticky={
stickyLeftColumnsIds.includes(header.id) ||
stickyLeftColumnGroupsIds.includes(header.id)
}
first={index === 0}
last={index + 1 === flatColumns.length}
/>
))
)}
{renderedRows}
</Box>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,6 @@ export const VirtualizedRows = {
stickyHeaders: true,
height: { custom: 340 },
virtualizeRows: { estimateRowHeight: () => 92 },
data: repeatToLength(exampleData, 10_000),
data: repeatToLength(exampleData, 1_000),
},
} satisfies Story;

0 comments on commit 9c003fb

Please sign in to comment.