on dc9fcd4 help sign in
urbit.org/components/PageWithIndex.js
43 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 markdownStyles from "../styles/markdown.module.css";
11import { decode } from "html-entities";
12import { TableOfContents } from "./TableOfContents";
14export default function PageWithIndex({ post, markdown, search }) {
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="flex sidebar">
32 <article
33 className={markdownStyles["markdown"] + " pr-0 lg:pr-16"}
34 dangerouslySetInnerHTML={{ __html: decode(markdown) }}
35 ></article>
36 <TableOfContents />
37 </div>
38 </Section>
39 </SingleColumn>
40 <Footer />
41 </Container>
42 );