Skip to content

Commit d4ea296

Browse files
committed
Improve the design of Table with sorting buttons
1 parent c0d4582 commit d4ea296

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/lib/components/Table/_components/TableCell.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
border-bottom-width: 2px;
1515
}
1616

17+
.tableHeadCellLayout {
18+
display: flex;
19+
gap: settings.$cell-padding-x;
20+
align-items: center;
21+
}
22+
1723
.isTableCellSortingActive,
1824
.isTableHeadCellSortingActive {
1925
background-color: settings.$sorted-background-color;
2026
}
21-
22-
.sortButton {
23-
display: inline-block;
24-
margin-right: settings.$cell-padding-x;
25-
}

src/lib/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,26 @@ export const TableHeaderCell = ({
1616
className={isSortingActive ? styles.isTableHeadCellSortingActive : styles.tableHeadCell}
1717
id={id}
1818
>
19-
{sort && column.isSortable && (
20-
<div className={styles.sortButton}>
19+
<span className={styles.tableHeadCellLayout}>
20+
{sort && column.isSortable && (
2121
<Button
22+
aria-pressed={isSortingActive}
2223
beforeLabel={
2324
sortDirection === 'asc'
2425
? sort.ascendingIcon
2526
: sort.descendingIcon
2627
}
28+
color={isSortingActive ? 'selected' : 'secondary'}
2729
id={id && `${id}__sortButton`}
2830
label={sortDirection}
2931
labelVisibility="none"
3032
onClick={() => sort.onClick(column.name, sortDirection)}
3133
priority="flat"
34+
size="small"
3235
/>
33-
</div>
34-
)}
35-
{column.label}
36+
)}
37+
{column.label}
38+
</span>
3639
</th>
3740
);
3841
};

0 commit comments

Comments
 (0)