chore: establish learning module baseline
This commit is contained in:
39
OpenMAIC/packages/docs/components/docs-page.tsx
Normal file
39
OpenMAIC/packages/docs/components/docs-page.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { source } from '@/lib/source';
|
||||
import {
|
||||
DocsBody,
|
||||
DocsDescription,
|
||||
DocsPage,
|
||||
DocsTitle,
|
||||
} from 'fumadocs-ui/layouts/docs/page';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { getMDXComponents } from '@/components/mdx';
|
||||
import { createRelativeLink } from 'fumadocs-ui/mdx';
|
||||
|
||||
/** Render a single docs page for a given slug + locale (shared by both trees). */
|
||||
export function RenderDocsPage({
|
||||
slug,
|
||||
lang,
|
||||
}: {
|
||||
slug: string[] | undefined;
|
||||
lang: string;
|
||||
}) {
|
||||
const page = source.getPage(slug, lang);
|
||||
if (!page) notFound();
|
||||
|
||||
const MDX = page.data.body;
|
||||
|
||||
return (
|
||||
<DocsPage toc={page.data.toc} full={page.data.full}>
|
||||
<DocsTitle>{page.data.title}</DocsTitle>
|
||||
<DocsDescription>{page.data.description}</DocsDescription>
|
||||
<DocsBody>
|
||||
<MDX
|
||||
components={getMDXComponents({
|
||||
// allows linking to other pages with relative file paths
|
||||
a: createRelativeLink(source, page),
|
||||
})}
|
||||
/>
|
||||
</DocsBody>
|
||||
</DocsPage>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user