Skip to content

Commit

Permalink
fix(#1530): table bottom align headers
Browse files Browse the repository at this point in the history
  • Loading branch information
syedszeeshan authored and ArakTaiRoth committed Aug 28, 2024
1 parent 8822d39 commit 87d9693
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions libs/web-components/src/assets/css/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@ goa-table[variant="relaxed"] td {
goa-table thead th {
background-color: var(--goa-color-greyscale-white);
color: var(--goa-color-text-secondary);
padding: 1rem;
padding: var(--goa-space-s) var(--goa-table-header-padding, var(--goa-space-m)) var(--goa-space-xs) var(--goa-table-header-padding, var(--goa-space-m));
text-align: left;
border-bottom: 2px solid var(--goa-color-greyscale-600);
vertical-align: bottom;
}

goa-table th:has(goa-table-sort-header) {
padding: 0;
}
}

.goa-table-number-column {
font: var(--goa-typography-number-m);
Expand All @@ -76,6 +72,10 @@ goa-table th:has(goa-table-sort-header) {
text-align: right;
}

.goa-table-number-header:not(:has(goa-table-sort-header)) {
padding-bottom: 0.5rem;
}

goa-table tfoot td {
background-color: var(--goa-color-greyscale-100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
if (_rootEl) {
// Add styling if an ancestor has a class to style number columns,
const hostEl = _rootEl.getRootNode().host;
const parentThead = hostEl?.closest("th");
parentThead?.style.setProperty("--goa-table-header-padding", "0");
const ancestor = hostEl?.closest("th.goa-table-number-header");
if (ancestor) {
_rootEl.style.setProperty("--header-text-align", "flex-end");
_rootEl.style.setProperty("--header-align", "right");
}
}
});
Expand Down Expand Up @@ -55,7 +59,8 @@
padding: 0 1rem;
justify-content: var(--header-text-align, flex-start);
gap: 0.25rem;
align-items: center;
align-items: flex-end;
text-align: var(--header-align, left);
}
/* User set classes */
Expand Down

0 comments on commit 87d9693

Please sign in to comment.