mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
71 lines
1.5 KiB
TypeScript
71 lines
1.5 KiB
TypeScript
import Footer from 'components/layout/footer';
|
|
import Header from 'components/layout/header';
|
|
import { NextIntlClientProvider } from 'next-intl';
|
|
import { Inter } from 'next/font/google';
|
|
import { notFound } from 'next/navigation';
|
|
import { ReactNode } from 'react';
|
|
import './globals.css';
|
|
|
|
const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env;
|
|
|
|
export const metadata = {
|
|
title: {
|
|
default: SITE_NAME,
|
|
template: `%s | ${SITE_NAME}`
|
|
},
|
|
robots: {
|
|
follow: true,
|
|
index: true
|
|
},
|
|
...(TWITTER_CREATOR &&
|
|
TWITTER_SITE && {
|
|
twitter: {
|
|
card: 'summary_large_image',
|
|
creator: TWITTER_CREATOR,
|
|
site: TWITTER_SITE
|
|
}
|
|
})
|
|
};
|
|
|
|
const inter = Inter({
|
|
subsets: ['latin'],
|
|
display: 'swap',
|
|
variable: '--font-inter'
|
|
});
|
|
|
|
export function generateStaticParams() {
|
|
return [{locale: 'sv'}, {locale: 'en'}, {locale: 'nn'}];
|
|
}
|
|
|
|
interface LocaleLayoutProps {
|
|
children: ReactNode
|
|
params: {
|
|
locale: string
|
|
}
|
|
}
|
|
|
|
export default async function LocaleLayout({children, params: {locale}}: LocaleLayoutProps) {
|
|
let messages;
|
|
try {
|
|
messages = (await import(`../../messages/${locale}.json`)).default;
|
|
} catch (error) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<html lang={locale} className={inter.variable}>
|
|
<body className="flex flex-col min-h-screen">
|
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
|
<Header />
|
|
<main className="flex-1">
|
|
{children}
|
|
</main>
|
|
<Footer />
|
|
</NextIntlClientProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|
|
|