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 ad34e35 commit 6a61e2e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
54 changes: 27 additions & 27 deletions packages/bento-design-system/src/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,33 +365,33 @@ export function Table<C extends ReadonlyArray<ColumnType<string, {}, any>>>({
});

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((column, index) => (
<ColumnHeader
column={column}
key={column.id}
style={stickyLeftColumnStyle[column.id]}
lastLeftSticky={index === lastStickyColumnIndex}
stickyHeaders={stickyHeaders}
sticky={stickyLeftColumnsIds.includes(column.id)}
first={index === 0}
last={index + 1 === columns.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((column, index) => (
<ColumnHeader
column={column}
key={column.id}
style={stickyLeftColumnStyle[column.id]}
lastLeftSticky={index === lastStickyColumnIndex}
stickyHeaders={stickyHeaders}
sticky={stickyLeftColumnsIds.includes(column.id)}
first={index === 0}
last={index + 1 === columns.length}
/>
))
)}
{renderedRows}
</Box>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,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 6a61e2e

Please sign in to comment.