summaryrefslogtreecommitdiff
path: root/assets/css/components/_content.scss
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-05-16 15:03:14 +0800
committerEltrac <hi@guhub.cn>2025-05-16 15:03:14 +0800
commit5d37a104c4a413df04e4b0fbcfe6cb026cd52136 (patch)
tree0cf4e97f743a0cf4722d636accf8a9e65ac8538e /assets/css/components/_content.scss
parent8275be2d2bb9f170000171671629fc215f2d91cb (diff)
perf: replace tocbot with statically generated toc
Generate TOC with Hugo's built-in {{ .TableOfContents }} and add minimal script to implement collapsible list and active styles. Encapsulate TOC as a component where all JavaSript and CSS is in one place with HTML. Configure markup. Former-commit-id: 4b4629edb733d5ebd6485755fd2f63b0457f62c8
Diffstat (limited to 'assets/css/components/_content.scss')
-rw-r--r--assets/css/components/_content.scss89
1 files changed, 0 insertions, 89 deletions
diff --git a/assets/css/components/_content.scss b/assets/css/components/_content.scss
deleted file mode 100644
index 6c5815cb..00000000
--- a/assets/css/components/_content.scss
+++ /dev/null
@@ -1,89 +0,0 @@
-/* toc */
-
-#toc-container {
- position: absolute;
- bottom: 0;
- right: calc(50% + var(--page-width) / 2);
- left: auto;
- height: 100%;
- top: 12rem;
-}
-
-@media screen and (max-width: 1200px) {
- #toc-container {
- display: none
- }
-}
-
-#toc {
- /* position */
- position: sticky;
- top: 3rem;
- /* styling */
- font-size: 1rem;
- padding: 0 2rem;
-}
-
-@media screen and (max-width: 1700px) {
- #toc {
- font-size: 0.9rem;
- }
-}
-
-@media screen and (max-width: 1500px) {
- #toc {
- font-size: 0.825rem;
- }
-}
-
-#toc ul, #toc ol {
- margin-block-start: 0;
- margin-block-end: 0;
- padding-inline-start: 1rem;
-}
-
-#toc li {
- list-style: none;
-}
-
-#toc li > a {
- color: var(--secondary-text-color);
- text-decoration: none;
- transition: color .3s;
- display: inline-flex;
- align-items: center;
- gap: .5rem;
-}
-
-#toc li > a::before {
- content: '';
- display: inline-block;
- width: 1rem;
- height: .3rem;
- background-color: var(--block-background-color);
- border-radius: .2rem;
- transition: background .3s;
-}
-
-#toc li a:hover,
-#toc li.is-active-li > a {
- color: var(--text-color);
-}
-
-#toc li.is-active-li > a::before {
- background-color: var(--secondary-text-color);
-}
-
-#toc .toc-list {
- overflow: hidden;
- position: relative;
-}
-
-#toc .toc-list .toc-list {
- max-height: 25rem;
- overflow-y: auto
-}
-
-#toc .toc-list.is-collapsed {
- max-height: 0
-}