feat: optimize some stuff
Some checks failed
Deploy to SFTP Server / build (push) Has been cancelled

This commit is contained in:
2024-04-08 20:51:10 +02:00
parent d1d6867130
commit f1c6bfdf87
3 changed files with 9 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import Logo from "./Logo.astro";
import ToggleTheme from "@components/ThemeToggle.svelte";
function isActive(path: string) {
return Astro.url.pathname === path;
return Astro.url.pathname.startsWith(path);
}
const t = useTranslations(Astro.url);

View File

@ -10,10 +10,9 @@ type Props = {
const { headings } = Astro.props;
---
<div class="toc-wrapper lg:fixed lg:left-6 lg:top-6">
<div class="toc-wrapper lg:fixed lg:left-6 lg:top-6 z-2">
<details
class="py-2 lg:px-4 rounded-xl lg:border lg:border-neutral flex flex-col lg:bg gap-2"
>
class="py-2 lg:px-4 rounded-xl lg:border lg:border-neutral flex flex-col lg:bg gap-2">
<summary class="text-lg cursor-pointer select-none"
>{t("toc.title")}</summary
>
@ -24,8 +23,7 @@ const { headings } = Astro.props;
<a
href={`#${heading.slug}`}
style={{ marginLeft: `${(heading.depth - 1) * 1}rem` }}
class={`block text my-0`}
>
class={`block text my-0`}>
{heading.text}
</a>
);