import Link from "next/link";
import type { ReactNode } from "react";
import { CloneUrlTabs, type CloneUrls } from "@/components/clone-button";
import { BookIcon, FileIcon, PlusIcon } from "@/components/icons";
import { Markdown } from "@/components/markdown";
import { Box } from "@/components/ui";
import type { WikiPage } from "@/lib/wiki";
import { pageHref } from "@/lib/wiki-links";
/** How many pages the sidebar lists before linking to all of them. */
const SIDEBAR_PAGES = 20;
/** An engraved heading over a sidebar group, with an optional readout at its right. */
function SectionLabel({ children, count }: { children: ReactNode; count?: number }) {
return (
{children}
{count !== undefined && {count}}
);
}
const quietLinkClass = "inline-flex items-center gap-1.5 type-meta text-ink2 transition-colors hover:text-ink [&_svg]:size-3";
/** "+ Add a custom sidebar": where a writer starts one of the special pages. */
export function AddSpecialLink({ wiki, slug, children }: { wiki: string; slug: string; children: ReactNode }) {
return (
{children}
);
}
/**
* The wiki's sidebar, like GitHub's: its pages, the custom _Sidebar page if there is one, and the
* clone URL.
*/
export function WikiSidebar({
wiki,
pages,
current,
sidebar,
canWrite,
cloneUrls,
}: {
wiki: string;
pages: WikiPage[];
current?: string;
/** The _Sidebar page's Markdown. */
sidebar: string | null;
canWrite: boolean;
cloneUrls: CloneUrls;
}) {
return (
);
}
/** The wiki's two columns: the page, then the sidebar. */
export function WikiColumns({ children, sidebar }: { children: ReactNode; sidebar: ReactNode }) {
return (