hugo-theme-minima/assets/sass/toc.scss
2021-12-02 13:52:55 +08:00

89 lines
1.4 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

details.toc {
position: sticky;
top: 0;
background-color: var(--bg);
transition: .5s all;
}
details.toc summary {
position: relative;
width: fit-content;
cursor: pointer;
background-color: var(--bg);
transition: .5s all;
}
details.toc div {
background-color: var(--bg);
transition: .5s all;
}
details.toc ul {
list-style-type: none;
padding-inline-start: 1em;
margin: 0;
}
details.toc ul > li {
margin: 1em 0;
}
details.toc-bar,
details.toc-lines {
& summary {
padding-right: 0.5em;
list-style: none;
}
& summary::-webkit-details-marker {
display: none;
}
& div {
padding-top: 1em;
}
}
details.toc-bar {
top: 1rem;
background-color: transparent;
& div {
top: -1em;
padding-top: 2em;
background-color: var(--bg);
}
& summary {
--toc-bar-ht: 4px;
--toc-bar-wd: 8%;
width: var(--toc-bar-wd);
height: var(--toc-bar-ht);
margin-left: calc(50% - var(--toc-bar-wd) / 2);
border-radius: calc(var(--toc-bar-ht) / 2);
background-color: var(--ft);
box-shadow: var(--bg) 0 0 8px 8px;
}
}
details.toc-default,
details.toc-lines {
& summary {
padding-top: 1em;
}
}
details.toc-lines {
& summary::before {
content: "";
font-size: 1.5em;
position: relative;
top: 0;
}
}
details[open] {
&.toc-lines summary::before {
content: "×";
font-size: 1.7em;
top: -4px;
}
}