Skip to content

Commit d5ac162

Browse files
committed
data-seo-container - refactor to use @extend in CSS
1 parent 3a17185 commit d5ac162

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

src/scss/04-utilities/_focus.scss

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ html {
1111
}
1212
}
1313

14-
[data-seo-container] {
15-
&:focus-within {
16-
outline: 1px solid currentColor;
17-
outline-offset: .5rem;
18-
}
19-
20-
*:focus {
21-
outline: none;
22-
}
23-
}
24-
2514
&:not([data-whatintent="keyboard"]) {
2615
a,
2716
button,
@@ -33,12 +22,23 @@ html {
3322
outline: none;
3423
}
3524
}
25+
}
26+
}
3627

37-
[data-seo-container] {
38-
&:focus-within,
39-
*:focus {
40-
outline: none;
41-
}
28+
%focus-seo-container {
29+
&:focus-within {
30+
outline: 2px solid currentColor;
31+
outline-offset: .5rem;
32+
}
33+
34+
*:focus {
35+
outline: none;
36+
}
37+
38+
html:not([data-whatintent="keyboard"]) & {
39+
&:focus-within,
40+
*:focus {
41+
outline: none;
4242
}
4343
}
4444
}

src/scss/04-utilities/_seo.scss

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
[data-seo-container] {
1+
%seo-container {
2+
@extend %focus-seo-container;
23
position: relative;
34
z-index: 1;
45
cursor: pointer;
6+
}
7+
8+
%seo-target {
9+
&::before {
10+
position: absolute;
11+
top: 0;
12+
right: 0;
13+
bottom: 0;
14+
left: 0;
15+
z-index: 100;
16+
content: "";
17+
}
18+
}
19+
20+
[data-seo-container] {
21+
@extend %seo-container;
522

623
[data-seo-target] {
7-
&::before {
8-
position: absolute;
9-
top: 0;
10-
right: 0;
11-
bottom: 0;
12-
left: 0;
13-
z-index: 100;
14-
content: "";
15-
}
24+
@extend %seo-target;
1625
}
1726
}

0 commit comments

Comments
 (0)