Skip to content

Commit

Permalink
Improve the design of Table with sorting buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkudrna committed Feb 22, 2023
1 parent c0d4582 commit d4ea296
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/lib/components/Table/_components/TableCell.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
border-bottom-width: 2px;
}

.tableHeadCellLayout {
display: flex;
gap: settings.$cell-padding-x;
align-items: center;
}

.isTableCellSortingActive,
.isTableHeadCellSortingActive {
background-color: settings.$sorted-background-color;
}

.sortButton {
display: inline-block;
margin-right: settings.$cell-padding-x;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@ export const TableHeaderCell = ({
className={isSortingActive ? styles.isTableHeadCellSortingActive : styles.tableHeadCell}
id={id}
>
{sort && column.isSortable && (
<div className={styles.sortButton}>
<span className={styles.tableHeadCellLayout}>
{sort && column.isSortable && (
<Button
aria-pressed={isSortingActive}
beforeLabel={
sortDirection === 'asc'
? sort.ascendingIcon
: sort.descendingIcon
}
color={isSortingActive ? 'selected' : 'secondary'}
id={id && `${id}__sortButton`}
label={sortDirection}
labelVisibility="none"
onClick={() => sort.onClick(column.name, sortDirection)}
priority="flat"
size="small"
/>
</div>
)}
{column.label}
)}
{column.label}
</span>
</th>
);
};
Expand Down

0 comments on commit d4ea296

Please sign in to comment.