Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
makishvili committed Jul 25, 2023
1 parent 6d38fc8 commit 5166ffb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions styles/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
list-style: none;
}

@mixin fixAnchorPosition($offset: 0px) {
// Works with scroll-padding-top (see /styles/default.css)
@mixin setHeadingPadding($offset: 0px) {
padding-top: calc(var(--dc-header-height, #{$headerHeight}) - #{$offset});
}

Expand Down
8 changes: 4 additions & 4 deletions styles/yfm.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@
// The margin is summed up. So, we need to take 15px away from the header margin-top
h1,
h2 {
@include fixAnchorPosition(calc(#{$headerMarginTopLarge} - #{$blockMarginBottomMedium}));
@include setHeadingPadding(calc(#{$headerMarginTopLarge} - #{$blockMarginBottomMedium}));
margin-bottom: $blockMarginBottomLarge;
}

h3,
h4,
h5,
h6 {
@include fixAnchorPosition(calc(#{$headerMarginTopMedium} - #{$blockMarginBottomMedium}));
@include setHeadingPadding(calc(#{$headerMarginTopMedium} - #{$blockMarginBottomMedium}));
}

// Use 0px for the top offset of the header if it is the first child element,
Expand All @@ -130,7 +130,7 @@
h5,
h6 {
&:first-child {
@include fixAnchorPosition();
@include setHeadingPadding();
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@
& + h4,
& + h5,
& + h6 {
@include fixAnchorPosition(#{$headerMarginTopLarge});
@include setHeadingPadding(#{$headerMarginTopLarge});
}
}

Expand Down

0 comments on commit 5166ffb

Please sign in to comment.