Skip to content

Commit 707a209

Browse files
committed
refactor: improve heading layout
1 parent 80bd792 commit 707a209

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

_sass/addon/commons.scss

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,29 @@ body {
4242
@extend %heading;
4343

4444
@if $i > 1 {
45-
@extend %section;
4645
@extend %anchor;
4746
}
4847

4948
@if $i < 5 {
50-
$factor: 0.18rem;
49+
$size-factor: 0.25rem;
5150

52-
@if $i == 1 {
53-
$factor: 0.23rem;
51+
@if $i > 1 {
52+
$size-factor: 0.18rem;
53+
54+
main & {
55+
@if $i == 2 {
56+
margin: 2.5rem 0 1.25rem;
57+
} @else {
58+
margin: 2rem 0 1rem;
59+
}
60+
}
5461
}
5562

56-
font-size: 1rem + (5 - $i) * $factor;
63+
& {
64+
font-size: 1rem + (5 - $i) * $size-factor;
65+
}
5766
} @else {
58-
font-size: 1rem;
67+
font-size: 1.05rem;
5968
}
6069
}
6170
}

_sass/addon/module.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@
1010
font-family: $font-family-heading;
1111
}
1212

13-
%section {
14-
main & {
15-
margin-top: 2.5rem;
16-
margin-bottom: 1.25rem;
17-
18-
&:focus {
19-
outline: none; /* avoid outline in Safari */
20-
}
21-
}
22-
}
23-
2413
%anchor {
2514
.anchor {
2615
font-size: 80%;

0 commit comments

Comments
 (0)