-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1e6980
commit e519202
Showing
3 changed files
with
47 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,48 @@ | ||
import Link from 'next/link'; | ||
import { pageTree } from './source'; | ||
import { getPage, getPages } from '@/app/source'; | ||
import type { Metadata } from 'next'; | ||
import { DocsPage, DocsBody } from 'fumadocs-ui/page'; | ||
import { notFound } from 'next/navigation'; | ||
import { DocsLayout } from 'fumadocs-ui/layout'; | ||
|
||
export default async function Page({ | ||
params, | ||
}: { | ||
params: { slug?: "index"[] }; | ||
}) { | ||
const page = getPage(params.slug); | ||
|
||
if (page == null) { | ||
notFound(); | ||
} | ||
|
||
const MDX = page.data.exports.default; | ||
|
||
export default function HomePage() { | ||
return ( | ||
<main className="flex h-screen flex-col justify-center text-center"> | ||
<h1 className="mb-4 text-2xl font-bold">Hello World</h1> | ||
<p className="text-muted-foreground"> | ||
You can open{' '} | ||
<Link href="/docs" className="text-foreground font-semibold underline"> | ||
/docs | ||
</Link>{' '} | ||
and see the documentation. | ||
</p> | ||
</main> | ||
<DocsLayout tree={pageTree}> | ||
<DocsPage toc={page.data.exports.toc}> | ||
<DocsBody> | ||
<h1>{page.data.title}</h1> | ||
<MDX /> | ||
</DocsBody> | ||
</DocsPage> | ||
</DocsLayout> | ||
); | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return getPages().map((page) => ({ | ||
slug: page.slugs, | ||
})); | ||
} | ||
|
||
export function generateMetadata({ params }: { params: { slug?: string[] } }) { | ||
const page = getPage(params.slug); | ||
|
||
if (page == null) notFound(); | ||
|
||
return { | ||
title: page.data.title, | ||
description: page.data.description, | ||
} satisfies Metadata; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,6 @@ | |
"autoprefixer": "^10.4.19", | ||
"postcss": "^8.4.38", | ||
"tailwindcss": "^3.4.4" | ||
} | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |