import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote"; import React, { ComponentType } from "react"; import { createLink, createReadAllSection, LinkProps, OrganizedContent, } from "@/components/OrganizedContent"; import { GetShapesConfig } from "../ShapesBackground"; import { Title } from "../Title"; import { Header } from "./Header"; export interface SerializedSection { section: { id: string; title: string; }; content: MDXRemoteSerializeResult; } export interface Props { sections: SerializedSection[]; } export interface Options { pagePath: string; title: string; image: string; getShapesConfig?: GetShapesConfig; imagePosition?: "left" | "right"; link?: ComponentType; description?: string; numberedSections?: boolean; } export function createReadAllPage({ title, image, pagePath, getShapesConfig, link, description, imagePosition, numberedSections = false, }: Options) { const Link = link ?? createLink(pagePath); function Page({ sections }: Props) { const readAllSection = createReadAllSection( sections.map(({ section, content }) => ({ section, Content() { return ; }, })), true, numberedSections ); return ( <> {title}
section), ]} numberedSections={numberedSections} pageTitle={title} link={Link} >
); } Page.getShapesConfig = getShapesConfig; return Page; }