Skip to content

Commit

Permalink
feat(header updates): remove white border-right from header cell, dis…
Browse files Browse the repository at this point in the history
…play border-right for each header cell on hover of table header component (#2630)

Co-authored-by: Carlos Cortizas <[email protected]>
  • Loading branch information
ByronDWall and CarlosCortizasCT authored Oct 23, 2023
1 parent 31c7908 commit 4e6399f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-hornets-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-uikit/data-table': minor
---

Display table header cell border for each cell on hover of table header
18 changes: 18 additions & 0 deletions packages/components/data-table/src/data-table.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { designTokens } from '@commercetools-uikit/design-system';
import { RowExpandCollapseButton } from './cell.styles';
import { BaseHeaderCell } from './header-cell.styles';
import convertNumericDimensionToPixelValue from './utils/convert-numeric-dimension-to-pixel-value';
import type { TDataTableProps } from './data-table';

Expand Down Expand Up @@ -103,6 +104,23 @@ const TableGrid = styled.table<TTableGrid>`

const TableHeader = styled.thead`
display: contents;
/* Adds right border that doesn't affect column width
* to each header cell when table header is hovered
*/
:hover {
${BaseHeaderCell}:before {
content: '';
position: absolute;
border-right: 1px solid ${designTokens.colorNeutral};
top: ${designTokens.spacing20};
right: 0;
bottom: ${designTokens.spacing20};
}
/* Does not display border on far right (last) header cell */
${BaseHeaderCell}:last-child:before {
display: none;
}
}
`;

const TableBody = styled.tbody`
Expand Down
3 changes: 0 additions & 3 deletions packages/components/data-table/src/header-cell.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ const BaseHeaderCell = styled.th<TBaseHeaderCell>`
font-weight: ${designTokens.fontWeightForTableHeader};
font-size: ${designTokens.fontSizeForTable};
/* right border that doesn't count towards the column width */
box-shadow: inset -1px 0 ${designTokens.borderColorForTableHeader};
/* this ensures that, when dragging this header's column resizer
it remains above the rest of the headers, preventing accidental hovers/flickering */
:hover,
Expand Down

1 comment on commit 4e6399f

@vercel
Copy link

@vercel vercel bot commented on 4e6399f Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.