SPB Git

Repository Public

Doc.tsx 1.1 KB 20 lines tsx

1import type { ReactNode } from "react";23/** Layout of the informational pages: a narrow reading column with a table of contents. */4export function Doc({ sections, updated, children, prose = true }: { sections: [string, string][]; updated: string; children: ReactNode; prose?: boolean }) {5  return (6    <div className="shell grid gap-10 py-10 md:py-14 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-16">7      <nav aria-label="Sommaire" className="no-print lg:sticky lg:top-24 lg:self-start">8        <p className="eyebrow">Sommaire</p>9        <ol className="mt-3 grid gap-1 text-[0.95rem]">{sections.map(([id, label]) => <li key={id}><a href={`#${id}`} className="block rounded-md py-1 text-muted hover:text-fg hover:underline">{label}</a></li>)}</ol>10        <p className="mt-6 text-sm text-faint">Dernière mise à jour : {updated}</p>11      </nav>12      <div className={prose ? "prose !max-w-[70ch]" : "min-w-0 max-w-[46rem] space-y-8"}>{children}</div>13    </div>14  );15}1617export function H({ id, children }: { id: string; children: ReactNode }) {18  return <h2 id={id} className="scroll-mt-28">{children}</h2>;19}20
Files main
Menu

Theme