WIP: floating TOC toggle on articles
This commit is contained in:
parent
f4feb28827
commit
e5a5f5e8b6
5 changed files with 59 additions and 5 deletions
|
@ -23,5 +23,6 @@
|
|||
|
||||
@import "features/autonumbering";
|
||||
@import "features/search";
|
||||
@import "features/syntax-highlighting";
|
||||
|
||||
@import "components/table-of-contents";
|
|
@ -1,5 +1,5 @@
|
|||
.hugo-content {
|
||||
*:first-child {
|
||||
> *:first-child {
|
||||
margin-block-start: 0;
|
||||
}
|
||||
/* text */
|
||||
|
@ -104,7 +104,7 @@
|
|||
line-height: 1.4;
|
||||
overflow: auto;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
display: grid;
|
||||
tab-size: 3;
|
||||
margin-block-end: 1em;
|
||||
|
@ -115,6 +115,8 @@
|
|||
color: var(--ui-overlay-text);
|
||||
padding: 0.25rem;
|
||||
font-size: 1rem;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
:not(.highlight) > pre {
|
||||
line-height: 1.5;
|
||||
|
|
|
@ -40,7 +40,55 @@
|
|||
max-width: 80ch;
|
||||
margin-inline: auto;
|
||||
}
|
||||
#toc-toggle {
|
||||
display: none;
|
||||
position: fixed;
|
||||
bottom: 1em;
|
||||
right: 1em;
|
||||
background-color: var(--ui-overlay);
|
||||
z-index: 5;
|
||||
outline: none;
|
||||
&:checked ~ .page-toc {
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
bottom: 5em;
|
||||
height: 80vh;
|
||||
overflow-y: scroll;
|
||||
right: 1em;
|
||||
background: var(--ui-overlay);
|
||||
}
|
||||
}
|
||||
label[for="toc-toggle"] {
|
||||
position: fixed;
|
||||
bottom: 1em;
|
||||
right: 1em;
|
||||
z-index: 5;
|
||||
background: var(--ui-overlay);
|
||||
padding: 1em;
|
||||
border-radius: 100em;
|
||||
width: 6em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
#toc-toggle__label-hide {
|
||||
display: none;
|
||||
}
|
||||
#toc-toggle:checked ~ #toc-toggle__label-hide {
|
||||
display: flex;
|
||||
}
|
||||
#toc-toggle:checked ~ #toc-toggle__label-show {
|
||||
display: none;
|
||||
}
|
||||
@media (min-width: 400px) {
|
||||
.container {
|
||||
padding: 0 2em;
|
||||
}
|
||||
}
|
||||
@media (min-width: 60rem) {
|
||||
label[for="toc-toggle"] {
|
||||
display: none;
|
||||
}
|
||||
.container {padding: 0;}
|
||||
.page[has-toc] {
|
||||
display: grid;
|
||||
|
@ -67,6 +115,8 @@
|
|||
align-self: start;
|
||||
justify-self: start;
|
||||
max-width: unset;
|
||||
border-inline-start: thin solid var(--ui-overlay);
|
||||
padding-inline-start: 2em;
|
||||
details {
|
||||
padding: 0;
|
||||
background: none;
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
@import "common";
|
||||
|
||||
@import "features/syntax-highlighting";
|
||||
@import "common";
|
|
@ -42,6 +42,9 @@
|
|||
<hr>
|
||||
</header>
|
||||
{{ if .Params.toc }}
|
||||
<input type="checkbox" id="toc-toggle">
|
||||
<label for="toc-toggle" id="toc-toggle__label-show">Show TOC</label>
|
||||
<label for="toc-toggle" id="toc-toggle__label-hide">Hide TOC</label>
|
||||
<aside class="page-toc toc section">
|
||||
<div class="container">
|
||||
<details open>
|
||||
|
|
Loading…
Reference in a new issue