mirror of
https://github.com/luxfi/explorer-v1.git
synced 2026-10-30 19:34:59 +00:00
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { source } from '@/lib/source';
|
|
import { DocsPage, DocsBody, DocsTitle, DocsDescription } from 'fumadocs-ui/page';
|
|
import { notFound } from 'next/navigation';
|
|
import type { Metadata } from 'next';
|
|
|
|
interface PageProps {
|
|
params: Promise<{ slug?: string[] }>;
|
|
}
|
|
|
|
export default async function Page(props: PageProps) {
|
|
const params = await props.params;
|
|
const page = source.getPage(params.slug);
|
|
if (!page) notFound();
|
|
|
|
const MDX = page.data.body;
|
|
const toc = page.data.toc;
|
|
|
|
return (
|
|
<DocsPage toc={toc}>
|
|
<DocsTitle>{page.data.title}</DocsTitle>
|
|
{page.data.description && (
|
|
<DocsDescription>{page.data.description}</DocsDescription>
|
|
)}
|
|
<DocsBody>
|
|
<MDX />
|
|
</DocsBody>
|
|
</DocsPage>
|
|
);
|
|
}
|
|
|
|
export async function generateStaticParams() {
|
|
return source.generateParams();
|
|
}
|
|
|
|
export async function generateMetadata(props: PageProps): Promise<Metadata> {
|
|
const params = await props.params;
|
|
const page = source.getPage(params.slug);
|
|
if (!page) return {};
|
|
|
|
return {
|
|
title: page.data.title,
|
|
description: page.data.description,
|
|
};
|
|
}
|