Skip to content

Commit

Permalink
fix: Layout for sortable column headers (#229)
Browse files Browse the repository at this point in the history
* Correct layout for sortable headers.

* fix: Finalize layout of Table headers.

* fix: sort icon spacing.
  • Loading branch information
Jesse Carmine authored Sep 11, 2020
1 parent fbc6f7b commit 804f0b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/components/Table/Table.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}

.table {
margin-top: 1px;
cursor: default;
width: 100%;
border-collapse: collapse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
}

.heading {
display: inline;
margin-right: var(--table-header-sort-icon-spacing);
white-space: initial;
white-space: nowrap;

.sort-icon {
margin-left: var(--table-header-sort-icon-spacing);
}
}
}
10 changes: 6 additions & 4 deletions src/components/Table/TableHeaderCell/TableHeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ const TableHeaderCell: FC<TableHeaderCellProps> = ({
};

return (
renderArrows()
<span className={styles['sort-icon']}>
{renderArrows()}
</span>
);
};

Expand Down Expand Up @@ -145,10 +147,10 @@ const TableHeaderCell: FC<TableHeaderCellProps> = ({
onClick={handleSort}
onKeyDown={handleKeyPress}
>
<span className={styles.heading}>
<div className={styles.heading}>
{column.heading}
</span>
{isSortable && renderIcon()}
{isSortable && renderIcon()}
</div>
</th>
);
};
Expand Down

0 comments on commit 804f0b9

Please sign in to comment.