Skip to content

Commit 56a4a9f

Browse files
authored
Merge pull request xch-dev#654 from dkackman/fix-table-borders
Fix table borders
2 parents 8295beb + c179a17 commit 56a4a9f

File tree

7 files changed

+67
-36
lines changed

7 files changed

+67
-36
lines changed

src/components/ui/data-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function DataTable<TData, TValue>({
8484
className='border'
8585
style={{ borderRadius: 'var(--table-border-radius, 0.375rem)' }}
8686
>
87-
<Table aria-label='Table'>
87+
<Table aria-label='Table' style={{ border: 'none' }}>
8888
<TableHeader>
8989
{table.getHeaderGroups().map((headerGroup) => (
9090
<TableRow key={headerGroup.id}>

src/index.css

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ body {
236236
/* Table styling variables with defaults */
237237
--table-background: transparent;
238238
--table-border: 1px solid var(--border);
239-
--table-border-radius: var(--radius);
240239
--table-box-shadow: var(--shadow-sm);
241240
--table-header-background: transparent;
242241
--table-header-color: var(--muted-foreground);
@@ -820,6 +819,9 @@ body {
820819
border: var(--table-border);
821820
border-radius: var(--table-border-radius);
822821
box-shadow: var(--table-box-shadow);
822+
overflow: hidden;
823+
border-collapse: separate;
824+
border-spacing: 0;
823825
}
824826

825827
.table-theme thead th {
@@ -830,15 +832,15 @@ body {
830832
font-size: var(--table-header-font-size);
831833
padding: var(--table-header-padding);
832834
backdrop-filter: var(--table-header-backdrop-filter);
833-
-webkit-backdrop-filter: var(--table-header-backdrop-filter);
835+
-webkit-backdrop-filter: var(--table-header-backdrop-filter-webkit);
834836
}
835837

836838
.table-theme tbody tr {
837839
background: var(--table-row-background);
838840
color: var(--table-row-color);
839841
border: var(--table-row-border);
840842
backdrop-filter: var(--table-row-backdrop-filter);
841-
-webkit-backdrop-filter: var(--table-row-backdrop-filter);
843+
-webkit-backdrop-filter: var(--table-row-backdrop-filter-webkit);
842844
}
843845

844846
.table-theme tbody tr:hover {
@@ -862,7 +864,7 @@ body {
862864
color: var(--table-footer-color);
863865
border: var(--table-footer-border);
864866
backdrop-filter: var(--table-footer-backdrop-filter);
865-
-webkit-backdrop-filter: var(--table-footer-backdrop-filter);
867+
-webkit-backdrop-filter: var(--table-footer-backdrop-filter-webkit);
866868
}
867869

868870
/* Backdrop filter utility classes */
@@ -907,12 +909,13 @@ body {
907909

908910
.table-theme thead th {
909911
backdrop-filter: var(--table-header-backdrop-filter);
910-
-webkit-backdrop-filter: var(--table-header-backdrop-filter);
912+
-webkit-backdrop-filter: var(--table-header-backdrop-filter-webkit);
911913
}
912914

913-
.table-theme tfoot th {
915+
.table-theme tfoot th,
916+
.table-theme tfoot td {
914917
backdrop-filter: var(--table-footer-backdrop-filter);
915-
-webkit-backdrop-filter: var(--table-footer-backdrop-filter);
918+
-webkit-backdrop-filter: var(--table-footer-backdrop-filter-webkit);
916919
}
917920
}
918921

src/lib/theme.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ export function applyTheme(theme: Theme, root: HTMLElement) {
197197
root.style.removeProperty(cssVar);
198198
});
199199

200+
// Set default table border radius if not specified by theme
201+
root.style.setProperty('--table-border-radius', 'var(--radius)', 'important');
202+
200203
applyThemeVariables(theme, root);
201204

202205
// Apply backdrop-filter variables if defined in colors object
@@ -373,6 +376,12 @@ export function applyTheme(theme: Theme, root: HTMLElement) {
373376
if (value && typeof value === 'string') {
374377
const cssVar = `--${prefix}-${property.replace(/([A-Z])/g, '-$1').toLowerCase()}`;
375378
root.style.setProperty(cssVar, value, 'important');
379+
380+
// For backdropFilter properties, also set the webkit version
381+
if (property === 'backdropFilter') {
382+
const webkitCssVar = `${cssVar}-webkit`;
383+
root.style.setProperty(webkitCssVar, value, 'important');
384+
}
376385
}
377386
});
378387
}
@@ -541,9 +550,13 @@ const tableVariableNames = [
541550
'--table-header-font-weight',
542551
'--table-header-font-size',
543552
'--table-header-padding',
553+
'--table-header-backdrop-filter',
554+
'--table-header-backdrop-filter-webkit',
544555
'--table-row-background',
545556
'--table-row-color',
546557
'--table-row-border',
558+
'--table-row-backdrop-filter',
559+
'--table-row-backdrop-filter-webkit',
547560
'--table-row-hover-background',
548561
'--table-row-hover-color',
549562
'--table-row-selected-background',
@@ -554,6 +567,8 @@ const tableVariableNames = [
554567
'--table-footer-background',
555568
'--table-footer-color',
556569
'--table-footer-border',
570+
'--table-footer-backdrop-filter',
571+
'--table-footer-backdrop-filter-webkit',
557572
];
558573

559574
const switchVariableNames = [

src/pages/Themes.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,12 @@ export default function Themes() {
248248
<Label className='text-base font-semibold block'>
249249
<Trans>Tables</Trans>
250250
</Label>
251-
<div className='rounded-md border'>
252-
<DataTable
253-
columns={demoColumns}
254-
data={demoTableData}
255-
rowLabel='item'
256-
rowLabelPlural='items'
257-
/>
258-
</div>
251+
<DataTable
252+
columns={demoColumns}
253+
data={demoTableData}
254+
rowLabel='item'
255+
rowLabelPlural='items'
256+
/>
259257
</div>
260258
</div>
261259
</div>

src/themes/amiga/theme.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,8 @@
4949
"card": "inset -1px -1px 0 0 rgb(85 85 85), inset 1px 1px 0 0 rgb(255 255 255)",
5050
"button": "inset -1px -1px 0 0 rgb(85 85 85), inset 1px 1px 0 0 rgb(255 255 255)",
5151
"dropdown": "inset -1px -1px 0 0 rgb(85 85 85), inset 1px 1px 0 0 rgb(255 255 255)"
52+
},
53+
"tables": {
54+
"borderRadius": "0px"
5255
}
5356
}

src/themes/xch-dark/theme.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
"foreground": "#edffb3",
1111
"card": "#171d26",
1212
"cardForeground": "#e8f3fc",
13-
"cardBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
14-
"cardBackdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)",
13+
"cardBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
1514
"popover": "#171d26",
1615
"popoverForeground": "#e8f3fc",
17-
"popoverBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
18-
"popoverBackdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)",
16+
"popoverBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
1917
"primary": "#dfff75",
2018
"primaryForeground": "#1d2530",
2119
"secondary": "#222c39",
@@ -28,9 +26,18 @@
2826
"destructiveForeground": "#fafafa",
2927
"border": "#263140",
3028
"input": "#1d2530",
31-
"ring": "#dfff75",
32-
"tableBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
33-
"tableBackdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)"
29+
"ring": "#dfff75"
30+
},
31+
"tables": {
32+
"header": {
33+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
34+
},
35+
"row": {
36+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
37+
},
38+
"footer": {
39+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
40+
}
3441
},
3542
"fonts": {
3643
"heading": "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
@@ -47,8 +54,7 @@
4754
"full": "9999px"
4855
},
4956
"sidebar": {
50-
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
51-
"backdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)"
57+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
5258
},
5359
"buttons": {
5460
"outline": {
@@ -104,4 +110,4 @@
104110
"button": "0 0 10px rgba(223, 255, 117, 0.2)",
105111
"input": "0 2px 4px rgba(10, 12, 16, 0.2)"
106112
}
107-
}
113+
}

src/themes/xch-light/theme.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
"foreground": "#2C323C",
1111
"card": "#f6fafe",
1212
"cardForeground": "#2C323C",
13-
"cardBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
14-
"cardBackdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)",
13+
"cardBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
1514
"popover": "#f6fafe",
1615
"popoverForeground": "#2C323C",
17-
"popoverBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
18-
"popoverBackdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)",
16+
"popoverBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
1917
"primary": "#324053",
2018
"primaryForeground": "#dfff75",
2119
"secondary": "#b4bfdf",
@@ -28,9 +26,18 @@
2826
"destructiveForeground": "#fafafa",
2927
"border": "#c9d2e8",
3028
"input": "#edf6fd",
31-
"ring": "#dfff75",
32-
"tableBackdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
33-
"tableBackdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)"
29+
"ring": "#dfff75"
30+
},
31+
"tables": {
32+
"header": {
33+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
34+
},
35+
"row": {
36+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
37+
},
38+
"footer": {
39+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
40+
}
3441
},
3542
"fonts": {
3643
"heading": "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
@@ -47,8 +54,7 @@
4754
"full": "9999px"
4855
},
4956
"sidebar": {
50-
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)",
51-
"backdropFilterWebkit": "blur(7px) saturate(150%) brightness(0.9)"
57+
"backdropFilter": "blur(7px) saturate(150%) brightness(0.9)"
5258
},
5359
"buttons": {
5460
"outline": {
@@ -104,4 +110,4 @@
104110
"button": "0 1px 3px rgba(223, 255, 117, 0.2)",
105111
"input": "0 1px 2px rgba(201, 210, 232, 0.1)"
106112
}
107-
}
113+
}

0 commit comments

Comments
 (0)