bbuddy-ui/src/app/[locale]/layout.tsx

55 lines
1.6 KiB
TypeScript

import React, { ReactNode } from 'react';
import { unstable_setRequestLocale } from 'next-intl/server';
import type { Metadata } from 'next';
import { Comfortaa, Inter } from 'next/font/google';
import { notFound } from 'next/navigation';
import { ConfigProvider } from 'antd';
import StyledComponentsRegistry from '../../lib/AntdRegistry';
import { ALLOWED_LOCALES } from '../../constants/locale';
import './global.css'
type RootLayoutProps = {
children: ReactNode;
params: { locale: string };
};
export function generateStaticParams() {
return ALLOWED_LOCALES.map((locale) => ({ locale }));
}
export const metadata: Metadata = {
title: 'Bbuddy'
};
const comfortaa = Comfortaa({
weight: ['300', '400', '500', '600', '700'],
subsets: ['latin', 'cyrillic'],
variable: '--font-comfortaa',
display: 'swap',
});
const inter = Inter({
weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],
subsets: ['latin', 'cyrillic'],
variable: '--font-inter',
display: 'swap',
});
export default function RootLayout({ children, params: { locale } }: RootLayoutProps) {
if (!ALLOWED_LOCALES.includes(locale as any)) notFound();
unstable_setRequestLocale(locale);
return (
<html lang={locale} className={`${comfortaa.variable} ${inter.variable}`}>
<body>
<StyledComponentsRegistry>
<ConfigProvider theme={{ cssVar: true, hashed: false }}>
{children}
</ConfigProvider>
</StyledComponentsRegistry>
</body>
</html>
);
}