prmbr-image-mksaas/src/app/[locale]/layout.tsx
javayhu c3a774e1cb fix: update docs & optimize docs layout & pages
- Translated the title and paragraphs in multiple .mdx files from Chinese to English for consistency and clarity.
- Adjusted the layout.tsx to change the font class for improved typography.
- Enhanced the Providers component with detailed comments for better understanding of the provider structure.
2025-03-30 10:34:49 +08:00

62 lines
1.7 KiB
TypeScript

import { fontBricolageGrotesque, fontDMMono, fontDMSans, fontDMSerifText } from '@/assets/fonts';
import { routing } from '@/i18n/routing';
import { cn } from '@/lib/utils';
import { hasLocale, Locale, NextIntlClientProvider } from 'next-intl';
import { notFound } from 'next/navigation';
import { ReactNode } from 'react';
import { Toaster } from 'sonner';
import { Providers } from './providers';
import { TailwindIndicator } from '@/components/tailwind-indicator';
import '@/styles/globals.css';
interface LocaleLayoutProps {
children: ReactNode;
params: Promise<{ locale: Locale }>;
}
/**
* 1. Locale Layout
* https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#layout
*
* 2. NextIntlClientProvider
* https://next-intl.dev/docs/usage/configuration#nextintlclientprovider
*/
export default async function LocaleLayout({
children,
params,
}: LocaleLayoutProps) {
const { locale } = await params;
// Ensure that the incoming `locale` is valid
if (!hasLocale(routing.locales, locale)) {
notFound();
}
return (
<html suppressHydrationWarning lang={locale}>
<body
suppressHydrationWarning
className={cn(
'size-full antialiased',
fontBricolageGrotesque.className,
fontDMSans.variable,
fontDMMono.variable,
fontDMSerifText.variable,
fontBricolageGrotesque.variable
)}
>
<NextIntlClientProvider>
<Providers>
{children}
<Toaster richColors position="top-right" offset={64} />
{/* <TailwindIndicator /> */}
</Providers>
</NextIntlClientProvider>
</body>
</html>
);
}