/** @jsx h */
import { h } from "preact";
import { apply, tw } from "@twind";
import {
CATEGORIES,
TableOfContentsCategory,
TableOfContentsCategoryEntry,
} from "../data/docs.ts";
export default function DocsSidebar(props: { path: string }) {
return (
{CATEGORIES.map((category) => (
))}
);
}
const link = apply`text(gray-900 hover:gray-600)`;
const linkActive = apply`text(green-600 hover:green-500)`;
export function SidebarCategory(props: {
path: string;
category: TableOfContentsCategory;
}) {
const outerItem = tw`my-2 block`;
const innerList = tw`pl-4 list-decimal` + " nested";
const { title, href, entries } = props.category;
const outerLink = tw`${href == props.path ? linkActive : link} font-bold`;
return (
{title}
{entries.length > 0 && (
{entries.map((entry) => (
))}
)}
);
}
export function SidebarEntry(props: {
path: string;
entry: TableOfContentsCategoryEntry;
}) {
const innerItem = tw`my-0.5`;
const { title, href } = props.entry;
const innerLink = tw`${href == props.path ? linkActive : link} font-normal`;
return (
{title}
);
}