Files
FixIt/assets/css/_partials/_single/_toc.scss
T

250 lines
4.4 KiB
SCSS

.toc {
.toc-title {
font-size: $toc-title-font-size;
font-weight: bold;
text-transform: uppercase;
}
.toc-content {
font-size: $toc-content-font-size;
ul {
text-indent: -0.8em;
padding-left: 0.8em;
list-style: none;
a:first-child::before {
content: '|';
font-weight: bolder;
margin-right: 0.5em;
position: relative;
bottom: 2px;
color: $single-link-color;
[data-theme='dark'] & {
color: $single-link-color-dark;
}
}
ul {
padding-left: 1em;
}
}
ol {
margin: 0;
padding-left: 2.25em;
ol {
padding-left: 1.25em;
}
li:has(> a:hover)::marker {
color: $single-link-color;
[data-theme='dark'] & {
color: $single-link-color-dark;
}
}
}
}
ruby {
background: $code-background-color;
rt {
color: $global-font-secondary-color;
}
[data-theme='dark'] & {
background: $code-background-color-dark;
rt {
color: $global-font-secondary-color-dark;
}
}
}
}
#toc-auto {
display: block;
position: sticky;
top: calc(#{$header-height} + var(--#{$prefix}breadcrumb-height));
box-sizing: border-box;
visibility: hidden;
@include overflow-wrap(break-word);
@include blur;
@extend .print-d-none;
[data-header-desktop='normal'] & {
--#{$prefix}scroll-mt: #{$global-scroll-margin-top};
}
.toc-title {
margin-block: 0 0.5em;
cursor: pointer;
@include user-select(none);
&::before {
content: '|';
font-weight: bolder;
margin-right: 0.5em;
position: relative;
bottom: 2px;
color: $global-border-color;
[data-theme='dark'] & {
color: $global-border-color-dark;
}
}
i.toc-icon {
@include transition(transform 0.2s ease);
}
}
&.toc-hidden i.toc-icon {
@include transform(rotate(-90deg));
@include transition(transform 0.2s ease);
}
.toc-content {
overflow-y: scroll;
max-height: calc(100vh - #{2*$header-height});
@include scrollbar-width(none, 0);
&.always-active ul,
&.always-active ol {
display: block;
}
> nav > ul {
margin: 0;
}
li.has-active {
&::marker {
color: $single-link-color;
[data-theme='dark'] & {
color: $single-link-color-dark;
}
}
&:has(> .active)::marker {
font-weight: bold;
}
> a {
color: $single-link-color;
[data-theme='dark'] & {
color: $single-link-color-dark;
}
}
}
// for unordered list automatically collapsed
ul {
ul {
display: none;
}
.has-active > ul {
display: block;
}
a.active::before {
color: $single-link-hover-color;
[data-theme='dark'] & {
color: $single-link-hover-color-dark;
}
}
}
// for ordered list automatically collapsed
ol {
ol {
display: none;
}
.has-active > ol {
display: block;
}
}
a.active {
font-weight: bold;
}
}
}
#toc-static {
display: none;
margin: 0.8em 0;
&[data-kept='true'] {
display: block;
}
.toc-title {
display: flex;
justify-content: space-between;
line-height: 2em;
padding: 0 0.75em;
background: darken($code-background-color, 3%);
[data-theme='dark'] & {
background: darken($code-background-color-dark, 6%);
}
}
.toc-content {
background-color: $code-background-color;
> nav {
> ul {
margin: 0;
padding: 0.4em 1em 0.4em 1.8em;
a:hover {
font-weight: bold;
&::before {
color: $single-link-hover-color;
[data-theme='dark'] & {
color: $single-link-hover-color-dark;
}
}
}
}
> ol {
margin: 0;
padding: 0.4em 1em 0.4em 2.25em;
li:has(> a:hover)::marker,
a:hover {
font-weight: bold;
}
}
}
[data-theme='dark'] & {
background-color: $code-background-color-dark;
}
}
&.open {
.toc-title {
background: darken($code-background-color, 6%);
[data-theme='dark'] & {
background: darken($code-background-color-dark, 3%);
}
}
}
}