Skip to content

Commit 0b034f2

Browse files
Merge pull request #828 from buildo/fixes_to_table
Change style of sticky columns padding when using dividers
2 parents fd64e19 + 35eaaf6 commit 0b034f2

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

packages/bento-design-system/src/Table/Table.css.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,23 @@ export const table = style({
99
isolation: "isolate",
1010
});
1111

12-
export const lastLeftStickyColumn = bentoSprinkles({
13-
background: "backgroundPrimary",
14-
paddingRight: 8,
12+
export const lastLeftStickyColumn = strictRecipe({
13+
variants: {
14+
withDividers: {
15+
true: style([
16+
{
17+
paddingRight: 2,
18+
},
19+
bentoSprinkles({
20+
background: "outlineDecorative",
21+
}),
22+
]),
23+
false: bentoSprinkles({
24+
background: "backgroundPrimary",
25+
paddingRight: 8,
26+
}),
27+
},
28+
},
1529
});
1630

1731
export const columnHeader = strictRecipe({

packages/bento-design-system/src/Table/Table.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,10 @@ function ColumnHeader<D extends Record<string, unknown>>({
585585

586586
return (
587587
<Box
588-
className={[lastLeftSticky && lastLeftStickyColumn, stickyHeaders && stickyColumnHeader]}
588+
className={[
589+
lastLeftSticky && lastLeftStickyColumn({ withDividers }),
590+
stickyHeaders && stickyColumnHeader,
591+
]}
589592
style={{
590593
...style,
591594
gridColumnEnd: column.columns ? `span ${column.columns.length}` : undefined,
@@ -650,7 +653,10 @@ function ColumnFooter<D extends Record<string, unknown>>({
650653

651654
return (
652655
<Box
653-
className={[lastLeftSticky && lastLeftStickyColumn, stickyFooters && stickyColumnFooter]}
656+
className={[
657+
lastLeftSticky && lastLeftStickyColumn({ withDividers }),
658+
stickyFooters && stickyColumnFooter,
659+
]}
654660
style={{
655661
...style,
656662
zIndex: sticky ? zIndexes.leftStickyHeader : zIndexes.header,
@@ -750,7 +756,7 @@ function CellContainer({
750756
const tableConfig = useBentoConfig().table;
751757

752758
return (
753-
<Box className={lastLeftSticky && lastLeftStickyColumn} style={style}>
759+
<Box className={lastLeftSticky && lastLeftStickyColumn({ withDividers })} style={style}>
754760
<Box
755761
background={index % 2 === 0 ? tableConfig.evenRowsBackgroundColor : "backgroundPrimary"}
756762
className={[

0 commit comments

Comments
 (0)