diff --git a/src/components/Widgets/Scrollbar.astro b/src/components/Widgets/Scrollbar.astro new file mode 100644 index 0000000..a8894ca --- /dev/null +++ b/src/components/Widgets/Scrollbar.astro @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/src/components/Widgets/TOC.astro b/src/components/Widgets/TOC.astro index fb8110d..557f31d 100644 --- a/src/components/Widgets/TOC.astro +++ b/src/components/Widgets/TOC.astro @@ -37,7 +37,7 @@ const filteredHeadings = headings.filter(heading =>
- + + @@ -94,7 +94,7 @@ const filteredHeadings = headings.filter(heading => --at-apply: 'grid rows-[0fr] duration-300 ease-in-out'; } .accordion-content { - --at-apply: 'overflow-hidden max-h-66 2xl:(max-h-[calc(100vh-21.5rem)]) pl-4 pr-6'; + --at-apply: 'max-h-66 overflow-hidden pl-4 pr-6 2xl:(max-h-[calc(100vh-21.5rem)] pl-2)'; } /* When toggle is checked, expand the wrapper to show content */ @@ -104,6 +104,15 @@ const filteredHeadings = headings.filter(heading => .accordion-toggle:checked ~ .accordion-wrapper .accordion-content { --at-apply: 'overflow-y-auto'; } +#toc-content::-webkit-scrollbar { + --at-apply: 'w-1.25 lg:w-1.5'; +} +#toc-content::-webkit-scrollbar-thumb { + --at-apply: 'rounded-full bg-secondary/15'; +} +#toc-content::-webkit-scrollbar-thumb:hover { + --at-apply: 'bg-secondary/25'; +} @media (min-width: 1536px) { .accordion-wrapper { @@ -121,6 +130,12 @@ const filteredHeadings = headings.filter(heading => .toc-link-active { --at-apply: 'c-secondary font-medium'; } + #toc-content { + --at-apply: 'scrollbar-hidden'; + } + #toc-content::-webkit-scrollbar { + display: none; + } } diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 48337a3..e81796d 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -5,6 +5,7 @@ import Header from '@/components/Header.astro' import Navbar from '@/components/Navbar.astro' import GithubCard from '@/components/Widgets/GithubCard.astro' import PhotoSwipe from '@/components/Widgets/PhotoSwipe.astro' +import Scrollbar from '@/components/Widgets/Scrollbar.astro' import themeConfig from '@/config' import Head from '@/layouts/Head.astro' import { getPageInfo } from '@/utils/page' @@ -31,11 +32,9 @@ const MarginBottom = isPost && themeConfig.comment?.enabled