mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
wip: Saving work
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
@@ -4,6 +4,7 @@ import localFont from 'next/font/local';
|
||||
import { ReactNode, Suspense } from 'react';
|
||||
|
||||
import { LanguageProvider } from 'app/context/language-context';
|
||||
import { getDictionary } from 'dictionaries';
|
||||
import './globals.css';
|
||||
|
||||
const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env;
|
||||
@@ -38,12 +39,6 @@ const cinzel = localFont({
|
||||
variable: '--font-cinzel'
|
||||
});
|
||||
|
||||
const mincho = localFont({
|
||||
src: '../fonts/A-OTF-A1MinchoStd-Bold.otf',
|
||||
display: 'swap',
|
||||
variable: '--font-cinzel'
|
||||
});
|
||||
|
||||
const alpina = localFont({
|
||||
src: [
|
||||
{
|
||||
@@ -60,6 +55,12 @@ const alpina = localFont({
|
||||
variable: '--font-alpina'
|
||||
});
|
||||
|
||||
const mincho = localFont({
|
||||
src: '../fonts/A-OTF-A1MinchoStd-Bold.otf',
|
||||
display: 'swap',
|
||||
variable: '--font-mincho'
|
||||
});
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return i18n.locales.map((locale) => ({ lang: locale }));
|
||||
}
|
||||
@@ -69,13 +70,15 @@ export default async function RootLayout({
|
||||
params
|
||||
}: {
|
||||
children: ReactNode;
|
||||
params: { lang: string };
|
||||
params: { lang: Locale };
|
||||
}) {
|
||||
const dictionary = await getDictionary(params?.lang);
|
||||
|
||||
return (
|
||||
<html lang={params.lang} className={`${cinzel.variable} ${alpina.variable} ${mincho.variable}`}>
|
||||
<body className="bg-dark text-white selection:bg-green-800 selection:text-green-400">
|
||||
<div className="mx-auto max-w-screen-2xl">
|
||||
<LanguageProvider language={params.lang as Locale}>
|
||||
<LanguageProvider language={params.lang as Locale} dictionary={dictionary}>
|
||||
<Navbar />
|
||||
<Suspense>
|
||||
<main>{children}</main>
|
||||
|
@@ -4,8 +4,7 @@ import Footer from 'components/layout/footer';
|
||||
import { LanguageControl } from 'components/layout/navbar/language-control';
|
||||
import type { Locale } from '../../i18n-config';
|
||||
|
||||
import Image from 'next/image';
|
||||
import Namemark from 'public/assets/images/namemark.png';
|
||||
import LogoNamemark from 'components/icons/namemark';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
export const runtime = 'edge';
|
||||
@@ -20,15 +19,13 @@ export const metadata = {
|
||||
};
|
||||
|
||||
export default async function HomePage({ params: { lang } }: { params: { lang: Locale } }) {
|
||||
// const dictionary = await getDictionary(lang);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="invisible absolute right-40 top-12 md:visible">
|
||||
<LanguageControl lang={lang} />
|
||||
</div>
|
||||
<div className="px-6 pb-12 pt-6 md:pb-48 md:pl-6 md:pt-12">
|
||||
<Image src={Namemark} alt="suginomori brewery" className="max-w-[260px] md:max-w-[600px]" />
|
||||
<LogoNamemark className="w-[260px] fill-current md:w-[600px]" />
|
||||
</div>
|
||||
<ThreeItemGrid lang={lang} />
|
||||
<Suspense>
|
||||
|
@@ -6,24 +6,29 @@ import { ReactNode, createContext, useContext, useState } from 'react';
|
||||
interface IContextProps {
|
||||
currentLanguage?: Locale;
|
||||
setCurrentLanguage: (language: Locale) => void;
|
||||
currentDictionary?: any;
|
||||
}
|
||||
|
||||
export const LanguageContext = createContext<IContextProps>({} as IContextProps);
|
||||
|
||||
export function LanguageProvider({
|
||||
language,
|
||||
dictionary,
|
||||
children
|
||||
}: {
|
||||
language: Locale;
|
||||
dictionary?: any;
|
||||
children: ReactNode | ReactNode[] | string;
|
||||
}) {
|
||||
const [currentLanguage, setCurrentLanguage] = useState<Locale>(language || 'en');
|
||||
const [currentDictionary] = useState<any | undefined>(dictionary);
|
||||
|
||||
return (
|
||||
<LanguageContext.Provider
|
||||
value={{
|
||||
currentLanguage,
|
||||
setCurrentLanguage
|
||||
setCurrentLanguage,
|
||||
currentDictionary
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
Reference in New Issue
Block a user