Skip to content

Instantly share code, notes, and snippets.

@FrancisGregori
Created November 25, 2023 23:26
Show Gist options
  • Save FrancisGregori/23e70f510233776f50119425a73ad715 to your computer and use it in GitHub Desktop.
Save FrancisGregori/23e70f510233776f50119425a73ad715 to your computer and use it in GitHub Desktop.
import { ReactNode } from 'react';
import { Inter } from 'next/font/google';
import { notFound } from 'next/navigation';
import Providers from '@/app/providers';
import Navbar from '@/components/Navbar';
import { locales } from '@/navigation';
const inter = Inter({ subsets: ['latin'] });
export function generateStaticParams() {
return locales.map((locale) => ({ locale }));
}
export default function LocaleLayout({
children,
params: { locale },
}: {
children: ReactNode;
params: { locale: string };
}) {
if (!locales.includes(locale as any)) notFound();
return (
<html lang={locale}>
<body className={inter.className}>
<Providers>
<Navbar locale={locale} />
{children}
</Providers>
</body>
</html>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment