on 39ecba7 help sign in
urbit.org/components/BasicPage.js
46 lines 1.3 kB history raw
1import { useRouter } from "next/router";
2import Head from "next/head";
3import Meta from "../components/Meta";
4import ErrorPage from "../pages/404";
5import {
6 Container,
7 SingleColumn,
8 Section,
9 Markdown,
10 IntraNav,
11 TableOfContents,
12} from "@urbit/foundation-design-system";
13import Header from "./Header";
14import Footer from "./Footer";
15import classNames from "classnames";
17export default function BasicPage({ post, markdown, search, index = false }) {
18 const router = useRouter();
19 if (!router.isFallback && !post?.slug) {
20 return <ErrorPage />;
21 }
22 return (
23 <Container>
24 <Head>
25 <title>{post.title}</title>
26 {Meta(post)}
27 </Head>
28 <IntraNav ourSite="https://urbit.org" search={search} />
29 <SingleColumn>
30 <Header search={search} />
31 <Section>
32 <h1>{post.title}</h1>
33 </Section>
34 <Section>
35 <div className={classNames("flex", { sidebar: index })}>
36 <div className={classNames("markdown", { "max-w-prose": index })}>
37 <Markdown.render content={JSON.parse(markdown)} />
38 </div>
39 {index && <TableOfContents />}
40 </div>
41 </Section>
42 </SingleColumn>
43 <Footer />
44 </Container>
45 );