{{ page.title }}
{% if page.description %} @@ -95,6 +97,30 @@{{ page.title }}
+ {{ page.title }}
+
+
+
+
+
+
+ {% endif %}
+
{{ content }}
diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss
index e2a0e6154b5..e332f21336a 100644
--- a/_sass/addon/commons.scss
+++ b/_sass/addon/commons.scss
@@ -908,9 +908,7 @@ $btn-mb: 0.5rem;
}
#topbar {
- button i {
- color: #999999;
- }
+ @extend %btn-color;
#breadcrumb {
font-size: 1rem;
diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss
index 42db4e2d991..34ac67b95ea 100644
--- a/_sass/addon/module.scss
+++ b/_sass/addon/module.scss
@@ -8,6 +8,7 @@
color: var(--heading-color);
font-weight: 400;
font-family: $font-family-heading;
+ scroll-margin-top: 3.5rem;
}
%anchor {
@@ -134,6 +135,12 @@
}
}
+%btn-color {
+ button i {
+ color: #999999;
+ }
+}
+
/* ---------- scss mixin --------- */
@mixin mt-mb($value) {
diff --git a/_sass/colors/typography-dark.scss b/_sass/colors/typography-dark.scss
index 12427ec494a..664c93653e6 100644
--- a/_sass/colors/typography-dark.scss
+++ b/_sass/colors/typography-dark.scss
@@ -22,7 +22,6 @@
--btn-border-color: #2e2f31;
--btn-backtotop-color: var(--text-color);
--btn-backtotop-border-color: #212122;
- --btn-box-shadow: var(--main-bg);
--card-header-bg: #292929;
--checkbox-color: rgb(118, 120, 121);
--checkbox-checked-color: var(--link-color);
@@ -60,6 +59,7 @@
/* Posts */
--toc-highlight: rgb(116, 178, 243);
+ --toc-popup-border-color: #373737;
--tag-hover: rgb(43, 56, 62);
--tb-odd-bg: #252526; /* odd rows of the posts' table */
--tb-even-bg: rgb(31, 31, 34); /* even rows of the posts' table */
diff --git a/_sass/colors/typography-light.scss b/_sass/colors/typography-light.scss
index 78000746925..b6fc5618ad5 100644
--- a/_sass/colors/typography-light.scss
+++ b/_sass/colors/typography-light.scss
@@ -22,7 +22,6 @@
--btn-border-color: #e9ecef;
--btn-backtotop-color: #686868;
--btn-backtotop-border-color: #f1f1f1;
- --btn-box-shadow: #eaeaea;
--checkbox-color: #c5c5c5;
--checkbox-checked-color: #07a8f7;
--img-bg: radial-gradient(
@@ -63,6 +62,7 @@
/* Posts */
--toc-highlight: #0550ae;
+ --toc-popup-border-color: lightgray;
--btn-share-color: gray;
--btn-share-hover-color: #0d6efd;
--card-bg: white;
diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss
index 815db933198..be727006b62 100644
--- a/_sass/layout/post.scss
+++ b/_sass/layout/post.scss
@@ -228,6 +228,7 @@ header {
}
}
+/* TOC panel */
#toc-wrapper {
border-left: 1px solid rgba(158, 158, 158, 0.17);
position: -webkit-sticky;
@@ -290,6 +291,201 @@ header {
}
}
+/* --- TOC button, bar and popup in mobile/tablet --- */
+
+#toc-bar {
+ position: -webkit-sticky;
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ margin: 0 -1rem;
+ height: $topbar-height;
+ background: var(--main-bg);
+ border-bottom: 1px solid var(--main-border-color);
+ transition: all 0.2s ease-in-out;
+
+ @extend %btn-color;
+
+ .label {
+ @extend %heading;
+
+ margin-left: 0.25rem;
+ padding: 0 0.75rem;
+ color: inherit;
+ }
+
+ &.invisible {
+ top: -$topbar-height;
+ transition: none;
+ }
+}
+
+#toc-solo-trigger {
+ color: var(--text-muted-color);
+ border-color: var(--btn-border-color);
+ border-radius: $radius-lg;
+
+ .label {
+ font-size: 1rem;
+ font-family: $font-family-heading;
+ }
+
+ &:hover {
+ box-shadow: none;
+ background: none;
+ }
+}
+
+@mixin slide-in {
+ from {
+ opacity: 0.7;
+ transform: translateY(-$topbar-height);
+ }
+
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@mixin slide-out {
+ 0% {
+ transform: translateY(0);
+ opacity: 1;
+ }
+
+ 100% {
+ transform: translateY(-$topbar-height);
+ opacity: 0;
+ }
+}
+
+@-webkit-keyframes slide-in {
+ @include slide-in;
+}
+
+@keyframes slide-in {
+ @include slide-in;
+}
+
+@-webkit-keyframes slide-out {
+ @include slide-out;
+}
+
+@keyframes slide-out {
+ @include slide-out;
+}
+
+#toc-popup {
+ $slide-in: slide-in 0.3s ease-out;
+ $slide-out: slide-out 0.3s ease-out;
+ $curtain-height: 2rem;
+
+ border-color: var(--toc-popup-border-color);
+ border-width: 1px;
+ border-radius: $radius-lg;
+ color: var(--text-color);
+ background: var(--main-bg);
+ margin-top: $topbar-height;
+ min-width: 20rem;
+ font-size: 1.05rem;
+
+ @media all and (min-width: 576px) {
+ max-width: 32rem;
+ }
+
+ &[open] {
+ -webkit-animation: $slide-in;
+ animation: $slide-in;
+ }
+
+ &[closing] {
+ -webkit-animation: $slide-out;
+ animation: $slide-out;
+ }
+
+ @media all and (min-width: 850px) {
+ left: $sidebar-width;
+ }
+
+ .header {
+ @extend %btn-color;
+
+ position: -webkit-sticky;
+ position: sticky;
+ top: 0;
+ background-color: inherit;
+ border-bottom: 1px solid var(--main-border-color);
+
+ .label {
+ font-family: $font-family-heading;
+ }
+ }
+
+ button:focus-visible {
+ box-shadow: none;
+ }
+
+ ul {
+ list-style-type: none;
+ padding-left: 0;
+
+ li {
+ ul,
+ & + li {
+ margin-top: 0.25rem;
+ }
+
+ a {
+ display: flex;
+ line-height: 1.5;
+ padding: 0.375rem 0;
+ padding-right: 1.125rem;
+
+ &.toc-link::before {
+ display: none;
+ }
+ }
+ }
+ }
+
+ @for $i from 2 through 4 {
+ .node-name--H#{$i} {
+ padding-left: 1.125rem * ($i - 1);
+ }
+ }
+
+ .is-active-link {
+ color: var(--toc-highlight) !important;
+ font-weight: 600;
+ }
+
+ &::-webkit-backdrop {
+ -webkit-backdrop-filter: blur(5px);
+ backdrop-filter: blur(5px);
+ }
+
+ &::backdrop {
+ -webkit-backdrop-filter: blur(5px);
+ backdrop-filter: blur(5px);
+ }
+
+ &::after {
+ display: flex;
+ content: '';
+ position: relative;
+ background: linear-gradient(transparent, var(--main-bg) 70%);
+ height: $curtain-height;
+ }
+
+ #toc-popup-content {
+ overflow: auto;
+ max-height: calc(100vh - 4 * $topbar-height);
+ font-family: $font-family-heading;
+ margin-bottom: -$curtain-height;
+ }
+}
+
/* --- Related Posts --- */
#related-posts {
@@ -368,3 +564,16 @@ header {
margin-right: -0.5rem;
}
}
+
+@media all and (min-width: 1200px) {
+ h2,
+ h3,
+ h4 {
+ scroll-margin-top: 2rem;
+ }
+
+ #toc-bar,
+ #toc-solo-trigger {
+ display: none !important;
+ }
+}