on cd863bb help sign in
urbit.org/components/BasicPage.js
42 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 Container from "./Container";
6import Header from "./Header";
7import Footer from "./Footer";
8import SingleColumn from "./SingleColumn";
9import Section from "./Section";
10import Markdown from "./Markdown";
11import classNames from "classnames";
12import { TableOfContents } from "./TableOfContents";
14export default function BasicPage({ post, markdown, search, index = false }) {
15 const router = useRouter();
16 if (!router.isFallback && !post?.slug) {
17 return <ErrorPage />;
18 }
19 return (
20 <Container>
21 <Head>
22 <title>Urbit • {post.title}</title>
23 {Meta(post)}
24 </Head>
25 <SingleColumn>
26 <Header search={search} />
27 <Section narrow>
28 <h1>{post.title}</h1>
29 </Section>
30 <Section narrow>
31 <div className={classNames("flex", { sidebar: index })}>
32 <div className={classNames("markdown", { "max-w-prose": index })}>
33 <Markdown content={JSON.parse(markdown)} />
34 </div>
35 {index && <TableOfContents />}
36 </div>
37 </Section>
38 </SingleColumn>
39 <Footer />
40 </Container>
41 );