Skip to content

Commit

Permalink
💄 Style: add sticky style for collection aside (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Dec 13, 2023
1 parent 443abcf commit 95612e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
7 changes: 5 additions & 2 deletions assets/css/_core/_breadcrumb.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.breadcrumb-container {
padding-inline: 1rem;
font-size: 0.75rem;
background-color: $global-background-color;
@include z-index(1);
@extend .print-d-none;

[data-theme='dark'] & {
background-color: $global-background-color-dark;
}

&.sticky {
position: sticky;
top: $header-height;
Expand All @@ -16,12 +21,10 @@
margin: 0 auto;
list-style: none;
border-bottom: 1px inset $global-border-color;
background-color: $global-background-color;
@extend %page-style;

[data-theme='dark'] & {
border-bottom-color: $global-border-color-dark;
background-color: $global-background-color-dark;
}

.breadcrumb-item {
Expand Down
12 changes: 11 additions & 1 deletion assets/css/_partials/_single/_collections.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
position: relative;
@include border-radius($global-border-radius * 1.5);
@include user-select(none);
@extend .print-d-none;

[data-theme='dark'] & {
background-color: lighten($global-background-color-dark, 3%);
Expand Down Expand Up @@ -82,9 +83,18 @@
}
}

// Collection aside container
.aside-collection {
position: sticky;
top: calc(#{$header-height} + var(--#{$prefix}breadcrumb-height));
box-sizing: border-box;
@include overflow-wrap(break-word);
@include blur;
@extend .print-d-none;
}

// Collection List
.collection-details {

&:not(:last-of-type) {
margin-bottom: 0.5rem;
}
Expand Down
3 changes: 1 addition & 2 deletions assets/css/_partials/_single/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@
#toc-auto {
display: block;
position: sticky;
top: var(--#{$prefix}scroll-mt);
top: calc(#{$header-height} + var(--#{$prefix}breadcrumb-height));
box-sizing: border-box;
visibility: hidden;
@include z-index(1);
@include overflow-wrap(break-word);
@include blur;
@extend .print-d-none;
Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class FixIt {
const $breadcrumbContainer = document.querySelector('.breadcrumb-container.sticky')
this.breadcrumbHeight = $breadcrumbContainer?.clientHeight ?? 0;
if (this.breadcrumbHeight) {
document.querySelector('#content')?.style.setProperty('--fi-breadcrumb-height', `${this.breadcrumbHeight}px`);
document.querySelector('main.container')?.style.setProperty('--fi-breadcrumb-height', `${this.breadcrumbHeight}px`);
}
}

Expand Down

0 comments on commit 95612e3

Please sign in to comment.