Skip to content

Commit c7ea23a

Browse files
fix(DataTable): fix padding issue when only some headers are sortable (#7888)
* fix(DataTable): fix padding issue when only some headers are sortable * style(DataTable): remove redundant selector Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent a987ca4 commit c7ea23a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

packages/components/src/components/data-table/_data-table-core.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,6 @@
110110
background-color: $ui-03;
111111
}
112112

113-
.#{$prefix}--data-table.#{$prefix}--data-table--sort th {
114-
padding: 0;
115-
}
116-
117-
.#{$prefix}--data-table.#{$prefix}--data-table--sort .#{$prefix}--table-sort {
118-
padding-left: $spacing-05;
119-
}
120-
121113
.#{$prefix}--data-table th:last-of-type {
122114
// Do not use `position: relative`, as its behavior is undefined for many table elements: https://www.w3.org/TR/CSS21/visuren.html#propdef-position
123115
position: static;

packages/components/src/components/data-table/_data-table-sort.scss

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
// -------------------------------------
1717
// Sortable table
1818
// -------------------------------------
19-
.#{$prefix}--data-table--sort th {
19+
.#{$prefix}--data-table--sort th,
20+
.#{$prefix}--data-table th[aria-sort] {
2021
height: $layout-04;
22+
padding: 0;
2123
border-top: none;
2224
border-bottom: none;
2325
}
@@ -33,8 +35,8 @@
3335
justify-content: space-between;
3436
width: 100%;
3537
min-height: 100%;
38+
padding-left: $spacing-05;
3639
color: $text-01;
37-
3840
font: inherit;
3941
line-height: 1;
4042
background-color: $ui-03;
@@ -56,10 +58,18 @@
5658
opacity: 1;
5759
}
5860

61+
// Override for when `isSortable` is set on `DataTable` as well as `TableHeader`
62+
.#{$prefix}--data-table.#{$prefix}--data-table--sort
63+
th
64+
> .#{$prefix}--table-header-label {
65+
padding-right: $spacing-05;
66+
padding-left: $spacing-05;
67+
}
68+
5969
// -------------------------------------
6070
// Th > Button > Span (span required for flex bugs in Safari)
6171
// -------------------------------------
62-
.#{$prefix}--data-table--sort th .#{$prefix}--table-sort__flex {
72+
th .#{$prefix}--table-sort__flex {
6373
display: flex;
6474
align-items: center;
6575
justify-content: space-between;

0 commit comments

Comments
 (0)