Skip to content

Commit

Permalink
fix: adjustments after daily
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikbacker committed Jan 23, 2025
1 parent db1ad7b commit 2b12b41
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions packages/css/src/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--dsc-table-background: var(--ds-color-neutral-background-default);
--dsc-table-border-color: var(--ds-color-neutral-border-subtle);
--dsc-table-border-divider: 2px solid var(--dsc-table-border-color);
--dsc-table-border-radius: var(--ds-border-radius-sm);
--dsc-table-border-radius: var(--ds-border-radius-md);
--dsc-table-border: 1px solid var(--dsc-table-border-color);
--dsc-table-color: var(--ds-color-neutral-text-default);
--dsc-table-header-background--hover: var(--ds-color-neutral-surface-default);
Expand Down Expand Up @@ -47,6 +47,10 @@
border-top: var(--dsc-table-border-divider);
}

& > tfoot > tr:last-child > :is(th, td) {
border-bottom: none;
}

& > caption {
@composes ds-heading from './heading.css';
text-align: inherit;
Expand Down Expand Up @@ -109,15 +113,22 @@
* Configurations
*/
&[data-border] {
border-radius: var(--ds-border-radius-md);
border-radius: var(--dsc-table-border-radius);
border: var(--dsc-table-border);

& > :last-child > tr:last-child > :is(th, td) {
border-bottom: none; /* Skip last border-bottom when <table> has border */
}

/* Add rounded border to first and last row */
& > :first-child > tr:first-child > :is(th, td) {

&
> :is(
thead:first-of-type /* If first <thead>, but using :first-of-type to support <caption> */,
:not(:has(thead)) tbody:first-of-type /* If <tbody> is :first-of-type and not followed by <thead> */
)
> tr:first-child
> :is(th, td) {
&:first-child {
border-top-left-radius: var(--dsc-table-border-radius);
}
Expand All @@ -127,8 +138,14 @@
}
}

/* Add rounded border to last row */
& > :last-child > tr:last-child > :is(th, td) {
/* Add rounded border to last row (using :last-of-type to suppoert <caption>) */
&
> :is(
tfoot:last-of-type /* If first <thead>, but using :first-of-type to support <caption> */,
:not(:has(tfoot)) tbody:last-of-type /* If <tbody> is :first-of-type and not followed by <thead> */
)
> tr:last-child
> :is(th, td) {
&:first-child {
border-bottom-left-radius: var(--dsc-table-border-radius);
}
Expand All @@ -150,6 +167,9 @@
}
}

&[data-zebra] > tbody > tr > :is(th, td) {
border-block: 0;
}
&[data-zebra] > :is(thead, tbody) > tr:nth-child(even) > :is(th, td) {
background: var(--dsc-table-background--zebra);
}
Expand Down

0 comments on commit 2b12b41

Please sign in to comment.