Skip to content

Commit

Permalink
fix: tup-488 scrollable table border (#265)
Browse files Browse the repository at this point in the history
- **fixed** outdated comment
- **added** top-of-rows border via thead
- **changed** top-of-rows border via tbody to only be for headless table
- **added** comments to explain unique cell borders
- **changed** comment to be consistent
  • Loading branch information
wesleyboar authored Nov 17, 2023
1 parent c165db5 commit b72046d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/core-styles.base.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/elements/table--basic.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/elements/table.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions src/lib/_imports/elements/table--basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ table,
--cell-line-height: 1.1;

/* To prevent borders from being hidden */
/* NOTE: Specifically, the right border of pinned columns (narrow windows) */
/* SEE: TABLE WITH A <thead> */
border-collapse: separate; /* overwrite Bootstrap */
border-spacing: 0;

Expand All @@ -19,9 +19,19 @@ table,
display: table; /* to mimic shrink-wrap width of real table */
}

/* To add top border to tbody (unless nested) */
/* FAQ: Added to cell, not row, because `border-collapse: separate` */
tbody > tr:first-child > :is(td, th),
/* TABLE WITH A <thead> */
/* FAQ: To __avoid__ <thead> border scrolling away on an `o-fixed-header-table`:
- border must be on the cells
- table must have `border-collapse: separate` */
thead tr:last-child :is(td, th) {
border-bottom: var(--global-border-width--normal) solid var(--global-color-primary--dark);
}
/* TABLE WITH NO <thead> */
/* FAQ: To __avoid__ styling a __nested__ table, must use direct selector `>` */
/* FAQ: To __ensure__ border is __visible__:
- border must be on cell
(because table has `border-collapse: separate`) */
tbody:not(thead + tbody) > tr:first-child > :is(td, th),
:--s-paragraph-table {
border-top: var(--global-border-width--normal) solid var(--global-color-primary--dark);
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/_imports/elements/table.cms.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ table,
border-bottom: var(--global-border-width--thick) solid var(--global-color-primary--dark);
}

/* To thicken top border of headless table */
/* TABLE WITH NO <thead> */
/* To thicken top border */
tbody:not(thead + tbody) > tr:first-child > :is(td,th),
:--s-paragraph-table {
border-top-width: var(--global-border-width--thick);
Expand Down

0 comments on commit b72046d

Please sign in to comment.