Skip to content

Commit 268fd17

Browse files
committed
[cleanup] DRY out cell outlien color to a CSS variable
1 parent b044581 commit 268fd17

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/components/datagrid/_data_grid_data_row.scss

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,20 @@
3333

3434
&:hover,
3535
&:focus {
36+
--euiDataGridCellOutlineColor: #{$euiColorPrimary};
3637
@include euiDataGridCellFocus;
3738
}
3839

3940
// On hover
4041
&:hover:not(:focus, :focus-within, .euiDataGridRowCell--open) {
42+
// Color the actions and focus ring grayscale on hover
43+
// (Actions look odd without the ring on grids without cell borders)
44+
--euiDataGridCellOutlineColor: #{$euiColorDarkShade};
45+
4146
.euiDataGridRowCell__actions {
4247
// Delay the actions showing on hover
4348
// (Note: the focus ring show instantly on hover & the actions show instantly on focus)
4449
animation-delay: $euiAnimSpeedSlow;
45-
46-
// Color the actions and focus ring grayscale on hover
47-
// (Actions look odd without the ring on grids without cell borders)
48-
background-color: $euiColorDarkShade;
49-
border-color: $euiColorDarkShade;
50-
color: $euiColorEmptyShade;
51-
}
52-
53-
&::after {
54-
border-color: $euiColorDarkShade;
5550
}
5651
}
5752

@@ -143,9 +138,9 @@
143138
display: flex;
144139
gap: $euiSizeXS / 2;
145140
padding-inline: $euiSizeXS / 2;
146-
background-color: $euiColorPrimary;
141+
background-color: var(--euiDataGridCellOutlineColor);
147142
color: $euiColorEmptyShade;
148-
border: $euiBorderWidthThin solid $euiColorPrimary;
143+
border: $euiBorderWidthThin solid var(--euiDataGridCellOutlineColor);
149144
border-top-left-radius: $euiBorderRadius / 2;
150145
border-top-right-radius: $euiBorderRadius / 2;
151146
transform: scaleY(0);
@@ -164,7 +159,7 @@
164159
top: 100%;
165160
height: $euiBorderWidthThick;
166161
width: $euiBorderWidthThick;
167-
background-color: red; // TODO - DRY out background-color
162+
background-color: var(--euiDataGridCellOutlineColor);
168163

169164
.euiDataGridRowCell--alignLeft & {
170165
left: -$euiBorderWidthThin;

src/components/datagrid/_mixins.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $euiDataGridStyles: (
6464
position: absolute;
6565
top: 0;
6666
left: 0;
67-
border: $euiBorderWidthThick solid $euiFocusRingColor;
67+
border: $euiBorderWidthThick solid var(--euiDataGridCellOutlineColor, $euiFocusRingColor);
6868
border-radius: $euiBorderRadius / 2;
6969
z-index: 2; // We want this to be on top of all the content
7070
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

0 commit comments

Comments
 (0)