Skip to content

Commit

Permalink
refactor: improve heading layout
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed Aug 24, 2024
1 parent 2f84ff4 commit f8faab0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
21 changes: 15 additions & 6 deletions _sass/addon/commons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,29 @@ body {
@extend %heading;

@if $i > 1 {
@extend %section;
@extend %anchor;
}

@if $i < 5 {
$factor: 0.18rem;
$size-factor: 0.25rem;

@if $i == 1 {
$factor: 0.23rem;
@if $i > 1 {
$size-factor: 0.18rem;

main & {
@if $i == 2 {
margin: 2.5rem 0 1.25rem;
} @else {
margin: 2rem 0 1rem;
}
}
}

font-size: 1rem + (5 - $i) * $factor;
& {
font-size: 1rem + (5 - $i) * $size-factor;
}
} @else {
font-size: 1rem;
font-size: 1.05rem;
}
}
}
Expand Down
11 changes: 0 additions & 11 deletions _sass/addon/module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@
font-family: $font-family-heading;
}

%section {
main & {
margin-top: 2.5rem;
margin-bottom: 1.25rem;

&:focus {
outline: none; /* avoid outline in Safari */
}
}
}

%anchor {
.anchor {
font-size: 80%;
Expand Down

0 comments on commit f8faab0

Please sign in to comment.