mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
wip: Working on footer
This commit is contained in:
22
app/[locale]/shop-list/ShopsTitle.tsx
Normal file
22
app/[locale]/shop-list/ShopsTitle.tsx
Normal 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>
|
||||
);
|
||||
}
|
15
app/[locale]/shop-list/layout.tsx
Normal file
15
app/[locale]/shop-list/layout.tsx
Normal 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>
|
||||
);
|
||||
}
|
11
app/[locale]/shop-list/opengraph-image.tsx
Normal file
11
app/[locale]/shop-list/opengraph-image.tsx
Normal 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 });
|
||||
}
|
49
app/[locale]/shop-list/page.tsx
Normal file
49
app/[locale]/shop-list/page.tsx
Normal 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>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user