tiff-personal/src/components/blog/TOCHeading.astro
houston[bot] 46709a2b20
Some checks failed
ci / Check for build and type issues (push) Has been cancelled
Initial commit from Astro
2025-04-22 15:19:27 -04:00

28 lines
523 B
Plaintext

---
import type { TocItem } from "@/utils/generateToc";
interface Props {
heading: TocItem;
}
const {
heading: { children, depth, slug, text },
} = Astro.props;
---
<li class={`${depth > 2 ? "ms-2" : ""}`}>
<a
class={`line-clamp-2 hover:text-accent ${depth <= 2 ? "mt-3" : "mt-2 text-xs"}`}
href={`#${slug}`}><span aria-hidden="true" class="me-0.5">#</span>{text}</a
>
{
!!children.length && (
<ol>
{children.map((subheading) => (
<Astro.self heading={subheading} />
))}
</ol>
)
}
</li>