11import { notFound } from 'next/navigation' ;
2- import defaultMdxComponents from 'fumadocs-ui/mdx' ;
3- import { DocsBody , DocsCategory , DocsDescription , DocsPage , DocsTitle } from 'fumadocs-ui/page' ;
2+ import { getPageTreePeers } from 'fumadocs-core/server' ;
3+ import { Card , Cards } from 'fumadocs-ui/components/card' ;
4+ import { DocsBody , DocsDescription , DocsPage , DocsTitle } from 'fumadocs-ui/page' ;
45
56import { metadataImage } from '@/lib/metadata' ;
6- import { openapi , source } from '@/lib/source' ;
7+ import { source } from '@/lib/source' ;
8+ import { getMDXComponents } from '@/mdx-components' ;
79import { getSiteUrl } from '@/utils/site' ;
810
11+ function DocsCategory ( { url } : { url : string } ) {
12+ return (
13+ < Cards >
14+ { getPageTreePeers ( source . pageTree , url ) . map ( ( peer ) => (
15+ < Card key = { peer . url } title = { peer . name } href = { peer . url } >
16+ { peer . description }
17+ </ Card >
18+ ) ) }
19+ </ Cards >
20+ ) ;
21+ }
22+
923export default async function Page ( props : { params : Promise < { slug ?: string [ ] } > } ) {
1024 const params = await props . params ;
1125 const page = source . getPage ( params . slug ) ;
@@ -25,8 +39,8 @@ export default async function Page(props: { params: Promise<{ slug?: string[] }>
2539 < DocsTitle > { page . data . title } </ DocsTitle >
2640 < DocsDescription > { page . data . description } </ DocsDescription >
2741 < DocsBody >
28- < MDX components = { { ... defaultMdxComponents , APIPage : openapi . APIPage } } />
29- { page . data . index ? < DocsCategory page = { page } from = { source } /> : null }
42+ < MDX components = { getMDXComponents ( ) } />
43+ { page . data . index ? < DocsCategory url = { page . url } /> : null }
3044 </ DocsBody >
3145 </ DocsPage >
3246 ) ;
0 commit comments