/
PageLayout.tsx
50 lines (45 loc) · 1.2 KB
/
PageLayout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { PortableText } from "@portabletext/react";
import clsx from "clsx";
import Layout from "components/Layout";
import PageHead from "components/PageHead";
import type { Page, Settings } from "lib/sanity.queries";
import { Container } from "react-bootstrap";
import Navigation from "./Nav";
import PortableTextRenderer from "./portableText/PortableTextRenderer";
export interface PageLayoutProps {
preview?: boolean;
loading?: boolean;
page: Page;
routes: any;
settings: Settings;
}
const PageLayout = (props: PageLayoutProps) => {
const {
preview,
loading,
page: { content, metadata },
settings,
routes,
} = props;
return (
<>
<PageHead pageMeta={metadata} settings={settings} />
<Layout loading={loading} preview={Boolean(preview)}>
<Navigation routes={routes} />
<Container>
<h1 className={clsx("pt-3")}>{content?.header ?? "Heading"}</h1>
<hr />
{content?.body ? (
<PortableText
components={PortableTextRenderer}
value={content.body}
/>
) : (
"Body"
)}
</Container>
</Layout>
</>
);
};
export default PageLayout;