Skip to content

Commit f9756a7

Browse files
committed
feat: update box styles to improve hover and focus effects with background color adjustments
1 parent 159ba01 commit f9756a7

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/styles/_box.scss

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@
2424
$color: variables.$secondary,
2525
$borderColor: variables.$secondary
2626
) {
27-
$mixedBorderWhite: color.mix($borderColor, variables.$white, 25%);
28-
$mixedBorderBlack: color.mix($borderColor, variables.$black, 25%);
29-
3027
&:hover {
31-
border-color: rgba($mixedBorderWhite, .25);
28+
background: helpers.backgroundColor($background, 1.5);
3229
}
3330
}
3431

@@ -37,10 +34,7 @@
3734
$color: variables.$secondary,
3835
$borderColor: variables.$secondary
3936
) {
40-
$mixedBorderWhite: color.mix($borderColor, variables.$white, 25%);
41-
$mixedBorderBlack: color.mix($borderColor, variables.$black, 25%);
42-
43-
border-color: rgba($mixedBorderWhite, .1);
37+
background: helpers.backgroundColor($background, 2);
4438
outline: none;
4539
}
4640

@@ -50,7 +44,7 @@
5044
$borderColor: variables.$secondary
5145
) {
5246

53-
&:active, &:focus {
47+
&:active, &:focus, &[aria-selected=true] {
5448
@include boxActiveStyle($background, $color, $borderColor);
5549
}
5650
}

src/styles/_helpers.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
}
3636

3737
@function backgroundColor($color: variables.$secondary, $level: 1) {
38+
@if($color == variables.$primary) {
39+
@if($level == 1) {
40+
@return variables.$primary
41+
}
42+
@return rgba(variables.$secondary, 10% * $level);
43+
}
3844
@return color.mix($color, variables.$primary, 10% * $level);
3945
}
4046

0 commit comments

Comments
 (0)