import { ArrowLeftIcon, ArrowRightIcon } from "@refs/design-system/icons"; import { data, Link } from "react-router"; import type { Route } from "./+types/docs"; import { SiteHeader } from "../components/landing"; import { refs } from "../lib/session"; import { DOC_SECTIONS, docPage, type DocLink, type DocSection } from "../lib/docs.server"; export const meta: Route.MetaFunction = ({ loaderData }) => loaderData ? [{ title: `${loaderData.page.title} · refs docs` }, { name: "description", content: loaderData.page.summary }] : [{ title: "Docs · refs" }]; export function loader({ params, context }: Route.LoaderArgs) { const found = docPage(params.page ?? "overview"); if (!found) throw data(null, { status: 404 }); return { ...found, sections: DOC_SECTIONS, signedIn: Boolean(refs(context).viewer.person) }; } function PageList({ sections, current }: { sections: readonly DocSection[]; current: string }) { return (
{sections.map((section) => (
{section.title} {section.pages.map((page) => ( {page.title} ))}
))}
); } function Neighbour({ link, direction }: { link: DocLink; direction: "previous" | "next" }) { const next = direction === "next"; return ( {!next && } {next ? "Next" : "Previous"} {next && } {link.title} ); } export default function Docs({ loaderData }: Route.ComponentProps) { const { page, previous, next, sections, signedIn } = loaderData; return (
Docs pages

{page.title}

{(previous || next) && ( )}
{page.headings.length > 1 && ( )}
); }