2021-08-23 09:27:59 -04:00
|
|
|
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote";
|
2021-08-25 15:12:09 -04:00
|
|
|
import React from "react";
|
2021-08-23 09:27:59 -04:00
|
|
|
|
2021-08-25 15:12:09 -04:00
|
|
|
import { createLink, OrganizedContent } from "@/components/OrganizedContent";
|
2021-08-23 09:27:59 -04:00
|
|
|
|
2021-08-30 19:20:16 -04:00
|
|
|
import { Title } from "../Title";
|
|
|
|
|
2021-08-23 09:27:59 -04:00
|
|
|
import { Header } from "./Header";
|
2021-08-25 15:12:09 -04:00
|
|
|
import { Options } from "./ReadAll";
|
2021-08-23 09:27:59 -04:00
|
|
|
|
|
|
|
interface Section {
|
|
|
|
id: string;
|
|
|
|
title: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
content: MDXRemoteSerializeResult;
|
|
|
|
sections: Section[];
|
|
|
|
current: number;
|
|
|
|
}
|
|
|
|
|
2021-08-25 15:12:09 -04:00
|
|
|
export function createSectionPage({
|
|
|
|
title,
|
|
|
|
image,
|
|
|
|
pagePath,
|
2021-08-27 01:45:14 -04:00
|
|
|
getShapesConfig,
|
2021-08-25 15:12:09 -04:00
|
|
|
link,
|
|
|
|
description,
|
|
|
|
imagePosition,
|
2021-08-30 19:20:16 -04:00
|
|
|
numberedSections,
|
2021-08-25 15:12:09 -04:00
|
|
|
}: Options) {
|
2021-08-23 09:27:59 -04:00
|
|
|
const Link = link ?? createLink(pagePath);
|
|
|
|
|
2021-08-27 01:45:14 -04:00
|
|
|
function Page(this: void, { content, sections, current }: Props) {
|
2021-08-23 09:27:59 -04:00
|
|
|
return (
|
2021-08-30 19:20:16 -04:00
|
|
|
<>
|
|
|
|
<Title>{[sections[current].title, title]}</Title>
|
|
|
|
<Header
|
|
|
|
title={title}
|
|
|
|
image={image}
|
|
|
|
description={description}
|
|
|
|
imagePosition={imagePosition}
|
2021-08-23 09:27:59 -04:00
|
|
|
>
|
2021-08-30 19:20:16 -04:00
|
|
|
<OrganizedContent
|
|
|
|
sections={sections}
|
|
|
|
id={sections[current].id}
|
|
|
|
pageTitle={title}
|
|
|
|
link={Link}
|
|
|
|
numberedSections={numberedSections}
|
|
|
|
>
|
|
|
|
<MDXRemote {...content} />
|
|
|
|
</OrganizedContent>
|
|
|
|
</Header>
|
|
|
|
</>
|
2021-08-23 09:27:59 -04:00
|
|
|
);
|
2021-08-27 01:45:14 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Page.getShapesConfig = getShapesConfig;
|
|
|
|
|
|
|
|
return Page;
|
2021-08-23 09:27:59 -04:00
|
|
|
}
|