File tree Expand file tree Collapse file tree 8 files changed +67
-34
lines changed
Expand file tree Collapse file tree 8 files changed +67
-34
lines changed Original file line number Diff line number Diff line change 1+ import type { routing } from '@/i18n/routing' ;
2+ import type messages from './messages/en.json' ;
3+
4+ declare module 'next-intl' {
5+ interface AppConfig {
6+ Locale : ( typeof routing . locales ) [ number ] ;
7+ Messages : typeof messages ;
8+ }
9+ }
Original file line number Diff line number Diff line change 1616 "fumadocs-core" : " 15.2.15" ,
1717 "fumadocs-mdx" : " 11.6.2" ,
1818 "fumadocs-ui" : " 15.2.15" ,
19+ "lucide-react" : " ^0.511.0" ,
1920 "next" : " 15.3.1" ,
2021 "next-intl" : " ^4.1.0" ,
2122 "react" : " ^19.1.0" ,
Original file line number Diff line number Diff line change 1- import { baseOptions } from '@/app/[locale]/layout.config ' ;
1+ import { useBaseOptions } from '@/hooks/useLayoutOptions ' ;
22import { HomeLayout } from 'fumadocs-ui/layouts/home' ;
3- import { useTranslations } from 'next-intl' ;
43import type { ReactNode } from 'react' ;
54
65export default function Layout ( { children } : { children : ReactNode } ) {
7- const t = useTranslations ( 'baseOptions' ) ;
8- return (
9- < HomeLayout { ...baseOptions ( { title : t ( 'title' ) } ) } > { children } </ HomeLayout >
10- ) ;
6+ const baseOptions = useBaseOptions ( ) ;
7+ return < HomeLayout { ...baseOptions } > { children } </ HomeLayout > ;
118}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import { routing } from '@/i18n/routing' ;
22import { getOramaDocuments } from '@/lib/orama/orama-document' ;
33import { sourceMap } from '@/lib/source' ;
4+ import type { Locale } from 'next-intl' ;
45
56import { NextResponse } from 'next/server' ;
67
78export const revalidate = false ;
89
910export async function GET (
1011 _req : Request ,
11- { params } : { params : Promise < { locale : string ; page : string } > } ,
12+ { params } : { params : Promise < { locale : Locale ; page : string } > } ,
1213) {
1314 const { locale, page = '0' } = await params ;
1415 const s = sourceMap [ locale ] ;
Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { baseOptions } from '@/app/[locale]/layout.config ' ;
3+ import { useBaseOptions } from '@/hooks/useLayoutOptions ' ;
44import type { PageTree } from 'fumadocs-core/server' ;
55import {
66 type DocsLayoutProps ,
77 DocsLayout as FumaDocsLayout ,
88} from 'fumadocs-ui/layouts/docs' ;
9- import { useTranslations } from 'next-intl' ;
109import type { ReactNode } from 'react' ;
1110
1211export function DocsLayout ( {
1312 children,
1413 pageTree,
15- } : { children : ReactNode ; pageTree : PageTree . Root } ) {
16- const t = useTranslations ( 'baseOptions' ) ;
14+ } : {
15+ children : ReactNode ;
16+ pageTree : PageTree . Root ;
17+ } ) {
18+ const baseOptions = useBaseOptions ( ) ;
1719 const docsLayout : DocsLayoutProps = {
18- ...baseOptions ( { title : t ( 'title' ) } ) ,
20+ ...baseOptions ,
1921 tree : pageTree ,
2022 sidebar : { } ,
21- githubUrl : 'https://github.com/xiaoyu2er/nextjs-i18n-docs' ,
2223 } ;
2324
2425 return < FumaDocsLayout { ...docsLayout } > { children } </ FumaDocsLayout > ;
Original file line number Diff line number Diff line change 1+ import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared' ;
2+ import { Book } from 'lucide-react' ;
3+ import { useTranslations } from 'next-intl' ;
4+
5+ export const useBaseOptions = ( ) => {
6+ const t = useTranslations ( 'baseOptions' ) ;
7+ return {
8+ nav : {
9+ title : (
10+ < >
11+ < svg
12+ width = "24"
13+ height = "24"
14+ xmlns = "http://www.w3.org/2000/svg"
15+ aria-label = "Logo"
16+ >
17+ < title > Logo</ title >
18+ < circle cx = { 12 } cy = { 12 } r = { 12 } fill = "currentColor" />
19+ </ svg >
20+ { t ( 'title' ) }
21+ </ >
22+ ) ,
23+ } ,
24+ githubUrl : 'https://github.com/xiaoyu2er/nextjs-i18n-docs' ,
25+ links : [
26+ {
27+ icon : < Book /> ,
28+ text : t ( 'doc' ) ,
29+ url : '/docs/' ,
30+ } ,
31+ ] ,
32+ } as BaseLayoutProps ;
33+ } ;
You can’t perform that action at this time.
0 commit comments