Skip to content

Commit

Permalink
[cleanup] DRY out cell outlien color to a CSS variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Nov 20, 2023
1 parent b044581 commit 268fd17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 8 additions & 13 deletions src/components/datagrid/_data_grid_data_row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,20 @@

&:hover,
&:focus {
--euiDataGridCellOutlineColor: #{$euiColorPrimary};
@include euiDataGridCellFocus;
}

// On hover
&:hover:not(:focus, :focus-within, .euiDataGridRowCell--open) {
// Color the actions and focus ring grayscale on hover
// (Actions look odd without the ring on grids without cell borders)
--euiDataGridCellOutlineColor: #{$euiColorDarkShade};

.euiDataGridRowCell__actions {
// Delay the actions showing on hover
// (Note: the focus ring show instantly on hover & the actions show instantly on focus)
animation-delay: $euiAnimSpeedSlow;

// Color the actions and focus ring grayscale on hover
// (Actions look odd without the ring on grids without cell borders)
background-color: $euiColorDarkShade;
border-color: $euiColorDarkShade;
color: $euiColorEmptyShade;
}

&::after {
border-color: $euiColorDarkShade;
}
}

Expand Down Expand Up @@ -143,9 +138,9 @@
display: flex;
gap: $euiSizeXS / 2;
padding-inline: $euiSizeXS / 2;
background-color: $euiColorPrimary;
background-color: var(--euiDataGridCellOutlineColor);
color: $euiColorEmptyShade;
border: $euiBorderWidthThin solid $euiColorPrimary;
border: $euiBorderWidthThin solid var(--euiDataGridCellOutlineColor);
border-top-left-radius: $euiBorderRadius / 2;
border-top-right-radius: $euiBorderRadius / 2;
transform: scaleY(0);
Expand All @@ -164,7 +159,7 @@
top: 100%;
height: $euiBorderWidthThick;
width: $euiBorderWidthThick;
background-color: red; // TODO - DRY out background-color
background-color: var(--euiDataGridCellOutlineColor);

.euiDataGridRowCell--alignLeft & {
left: -$euiBorderWidthThin;
Expand Down
2 changes: 1 addition & 1 deletion src/components/datagrid/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $euiDataGridStyles: (
position: absolute;
top: 0;
left: 0;
border: $euiBorderWidthThick solid $euiFocusRingColor;
border: $euiBorderWidthThick solid var(--euiDataGridCellOutlineColor, $euiFocusRingColor);
border-radius: $euiBorderRadius / 2;
z-index: 2; // We want this to be on top of all the content
pointer-events: none; // Because we put it with a higher z-index we don't want to make it clickable this way we allow selecting the content behind
Expand Down

0 comments on commit 268fd17

Please sign in to comment.