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
|
|
|
|
|
|
|
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,
|
|
|
|
link,
|
|
|
|
description,
|
|
|
|
imagePosition,
|
|
|
|
}: Options) {
|
2021-08-23 09:27:59 -04:00
|
|
|
const Link = link ?? createLink(pagePath);
|
|
|
|
|
|
|
|
return function Page(this: void, { content, sections, current }: Props) {
|
|
|
|
return (
|
2021-08-25 15:12:09 -04:00
|
|
|
<Header
|
|
|
|
title={title}
|
|
|
|
image={image}
|
|
|
|
description={description}
|
|
|
|
imagePosition={imagePosition}
|
|
|
|
>
|
2021-08-23 09:27:59 -04:00
|
|
|
<OrganizedContent
|
|
|
|
sections={sections}
|
|
|
|
id={sections[current].id}
|
2021-08-26 18:15:38 -04:00
|
|
|
pageTitle={title}
|
2021-08-23 09:27:59 -04:00
|
|
|
link={Link}
|
|
|
|
>
|
|
|
|
<MDXRemote {...content} />
|
|
|
|
</OrganizedContent>
|
|
|
|
</Header>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|