11'use client' ;
22
33import { useBaseOptions } from '@/hooks/useLayoutOptions' ;
4+ import { parseDocId } from '@/lib/utils' ;
5+ import {
6+ NextAppIcon ,
7+ NextLastedVersionIcon ,
8+ NextOldVersionIcon ,
9+ NextPagesIcon ,
10+ } from '@/mdx/Icon' ;
411import type { PageTree } from 'fumadocs-core/server' ;
12+ import { RootToggle } from 'fumadocs-ui/components/layout/root-toggle' ;
513import {
614 type DocsLayoutProps ,
715 DocsLayout as FumaDocsLayout ,
8- } from 'fumadocs-ui/layouts/docs ' ;
16+ } from 'fumadocs-ui/layouts/notebook ' ;
917import type { ReactNode } from 'react' ;
1018
1119export function DocsLayout ( {
@@ -18,10 +26,57 @@ export function DocsLayout({
1826 docId : string ;
1927} ) {
2028 const baseOptions = useBaseOptions ( ) ;
29+ const { appDocsRoot, pagesDocsRoot, docsRoot } = parseDocId ( docId ) ;
30+
2131 const docsLayout : DocsLayoutProps = {
2232 ...baseOptions ,
33+ links : [ ] ,
2334 tree : pageTree ,
24- sidebar : { } ,
35+ sidebar : {
36+ banner : (
37+ < >
38+ < RootToggle
39+ options = { [
40+ {
41+ title : 'Using App Router' ,
42+ description : 'Features available in /app' ,
43+ icon : < NextAppIcon /> ,
44+ url : appDocsRoot ,
45+ urls : new Set ( [ docsRoot , appDocsRoot ] ) ,
46+ } ,
47+ {
48+ title : 'Using Pages Router' ,
49+ description : 'Features available in /pages' ,
50+ icon : < NextPagesIcon /> ,
51+ url : pagesDocsRoot ,
52+ } ,
53+ ] }
54+ />
55+ < RootToggle
56+ options = { [
57+ {
58+ title : 'Using Latest Version' ,
59+ description : '15.3.2' ,
60+ icon : < NextLastedVersionIcon /> ,
61+ url : '/docs/' ,
62+ } ,
63+ {
64+ title : 'Using Version 14' ,
65+ description : '14.2.29' ,
66+ icon : < NextOldVersionIcon /> ,
67+ url : '/docs/14' ,
68+ } ,
69+ {
70+ title : 'Using Version 13' ,
71+ description : '13.5.11' ,
72+ icon : < NextOldVersionIcon /> ,
73+ url : '/docs/13' ,
74+ } ,
75+ ] }
76+ />
77+ </ >
78+ ) ,
79+ } ,
2580 } ;
2681
2782 return < FumaDocsLayout { ...docsLayout } > { children } </ FumaDocsLayout > ;
0 commit comments