Skip to content

Commit

Permalink
EPMRPP-92483 | Table header hoverable-clickable area fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maria-hambardzumian committed Jul 2, 2024
1 parent 73f51af commit 4454f72
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
10 changes: 9 additions & 1 deletion src/components/table/table.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ $HEIGHT-LARGE: 80px;
text-align: left;
background: none;
border: none;
cursor: pointer;

.label {
display: flex;
align-items: center;
}

&.sortable-cell > .label{
cursor: pointer;
}

&.align-right {
justify-content: flex-end;
Expand Down
20 changes: 12 additions & 8 deletions src/components/table/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,20 @@ export const Table: FC<TableComponentProps> = ({
className={cx('table-header-cell', {
[`align-${(column as FixedColumn).align}`]: 'align' in column,
'primary-cell': 'primary' in column && column.primary,
'sortable-cell': sortableColumns.includes(column.key),
})}
style={getCellStyle(column as FixedColumn)}
onClick={() => handleSort(column.key)}
onMouseEnter={() => handleMouseEnter(column.key)}
onMouseLeave={handleMouseLeave}
>
<span>{column.header}</span>

{(hoveredColumn === column.key || sortingColumn?.key === column.key) &&
getSortIcon(column.key)}
<div
className={cx('label')}
onClick={() => handleSort(column.key)}
onMouseEnter={() => handleMouseEnter(column.key)}
onMouseLeave={handleMouseLeave}
>
<span>{column.header}</span>
{(hoveredColumn === column.key || sortingColumn?.key === column.key) &&
getSortIcon(column.key)}
</div>
</button>
))}
{rowActionMenu && <div className={cx('table-header-cell', 'action-menu-cell')} />}
Expand Down Expand Up @@ -143,7 +147,7 @@ export const Table: FC<TableComponentProps> = ({
{columns.map((column) => (
<div
key={column.key}
className={cx('table-cell', 'table-cell', {
className={cx('table-cell', {
'primary-cell': 'primary' in column && column.primary,
})}
style={getCellStyle(column as FixedColumn)}
Expand Down

0 comments on commit 4454f72

Please sign in to comment.