import {
CATEGORIES,
TableOfContentsCategory,
TableOfContentsCategoryEntry,
} from "../data/docs.ts";
import SearchButton from "../islands/SearchButton.tsx";
import VersionSelect from "../islands/VersionSelect.tsx";
import { type VersionLink } from "../routes/docs/[...slug].tsx";
export default function DocsSidebar(
props: {
path: string;
mobile?: boolean;
versionLinks: VersionLink[];
selectedVersion: string;
},
) {
return (
<>
{props.mobile
? (
)
: }
{CATEGORIES[props.selectedVersion].map((category) => (
))}
>
);
}
const link = "text(gray-900 hover:gray-600)";
const linkActive = "text(green-600 hover:green-500) font-bold";
export function SidebarCategory(props: {
path: string;
category: TableOfContentsCategory;
}) {
const { title, href, entries } = props.category;
const outerLink = `${href == props.path ? linkActive : link} font-bold`;
return (
{title}
{entries.length > 0 && (
{entries.map((entry) => (
))}
)}
);
}
export function SidebarEntry(props: {
path: string;
entry: TableOfContentsCategoryEntry;
}) {
const { title, href } = props.entry;
const innerLink = `${
href == props.path ? linkActive : link
} transition-colors hover:text-green-500 font-normal`;
return (
{title}
);
}