wip: Working on footer

This commit is contained in:
Sol Irvine
2023-08-18 18:32:01 +09:00
parent ce7f51a600
commit 95d237c4ac
18 changed files with 141 additions and 80 deletions

View File

@@ -0,0 +1,22 @@
'use client';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
export default function ShopsTitle() {
const t = useTranslations('Index');
return (
<div>
<div className="flex flex-row items-baseline space-x-6 pb-12">
<Link href="/#shops">
<span className="flex flex-row items-center space-x-1.5">
<span></span>
<span>{t('shops.all')}</span>
</span>
</Link>
<div>|</div>
<div className="font-medium">{t('shops.title')}</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,15 @@
import Footer from 'components/layout/footer';
import { Suspense } from 'react';
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Suspense>
<div className="w-full">
<div className="mx-8 max-w-screen-2xl py-20 sm:mx-auto">
<Suspense>{children}</Suspense>
</div>
</div>
<Footer />
</Suspense>
);
}

View File

@@ -0,0 +1,11 @@
import OpengraphImage from 'components/opengraph-image';
import { getPage } from 'lib/shopify';
export const runtime = 'edge';
export default async function Image({ params }: { params: { page: string } }) {
const page = await getPage({ handle: params.page });
const title = page.seo?.title || page.title;
return await OpengraphImage({ title });
}

View File

@@ -0,0 +1,49 @@
import type { Metadata } from 'next';
import LogoNamemark from 'components/icons/namemark';
import { SupportedLocale } from 'components/layout/navbar/language-control';
import Prose from 'components/prose';
import { getPage } from 'lib/shopify';
import { notFound } from 'next/navigation';
import ShopsTitle from './ShopsTitle';
export const runtime = 'edge';
export const revalidate = 43200; // 12 hours in seconds
export async function generateMetadata({
params
}: {
params: { locale?: SupportedLocale };
}): Promise<Metadata> {
const page = await getPage({ handle: 'shop-list', language: params?.locale?.toUpperCase() });
if (!page) return notFound();
return {
title: page.seo?.title || page.title,
description: page.seo?.description || page.bodySummary,
openGraph: {
publishedTime: page.createdAt,
modifiedTime: page.updatedAt,
type: 'article'
}
};
}
export default async function Page({ params }: { params: { locale?: SupportedLocale } }) {
const page = await getPage({ handle: 'shop-list', language: params?.locale?.toUpperCase() });
if (!page) return notFound();
return (
<div className="font-multilingual min-h-screen px-4 text-white">
<div className="pb-12">
<LogoNamemark className="w-[260px] fill-current md:w-[320px]" />
</div>
<ShopsTitle />
<h2 className="mb-8 text-3xl font-medium">{page.title}</h2>
<Prose className="mb-8" html={page.body as string} />
</div>
);
}