mirror of
https://github.com/luxfi/docs-template.git
synced 2026-10-30 16:58:41 +00:00
- Update dependencies to @hanzo/docs packages (16.2.9) - Update imports: fumadocs-ui -> @hanzo/docs/ui - Update CSS import to @hanzo/docs/ui/css/neutral.css - Add autoprefixer dependency - Compatible with Next.js 16.1.1
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { source } from '@/lib/source'
|
|
import type { Metadata } from 'next'
|
|
import { DocsPage, DocsBody, DocsTitle, DocsDescription } from '@hanzo/docs-base-ui/layouts/docs/page'
|
|
import { notFound } from 'next/navigation'
|
|
import ReactMarkdown from 'react-markdown'
|
|
import remarkGfm from 'remark-gfm'
|
|
|
|
export default async function Page(props: {
|
|
params: Promise<{ slug?: string[] }>
|
|
}) {
|
|
const params = await props.params
|
|
const page = source.getPage(params.slug)
|
|
if (!page) notFound()
|
|
|
|
return (
|
|
<DocsPage toc={page.data.toc} full={page.data.full}>
|
|
<DocsTitle>{page.data.title}</DocsTitle>
|
|
<DocsDescription>{page.data.description}</DocsDescription>
|
|
<DocsBody>
|
|
<div className="prose prose-neutral dark:prose-invert max-w-none">
|
|
<ReactMarkdown remarkPlugins={[remarkGfm]}>
|
|
{page.data.content}
|
|
</ReactMarkdown>
|
|
</div>
|
|
</DocsBody>
|
|
</DocsPage>
|
|
)
|
|
}
|
|
|
|
export async function generateStaticParams() {
|
|
return source.generateParams()
|
|
}
|
|
|
|
export async function generateMetadata(props: {
|
|
params: Promise<{ slug?: string[] }>
|
|
}): Promise<Metadata> {
|
|
const params = await props.params
|
|
const page = source.getPage(params.slug)
|
|
if (!page) notFound()
|
|
|
|
return {
|
|
title: page.data.title,
|
|
description: page.data.description,
|
|
}
|
|
}
|