mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Structural changes
This commit is contained in:
41
app/[locale]/category/[slug]/page.tsx
Normal file
41
app/[locale]/category/[slug]/page.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import Text from 'components/ui/text/text';
|
||||
import { categoryQuery } from 'lib/sanity/queries';
|
||||
import { clientFetch } from 'lib/sanity/sanity.client';
|
||||
import { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
export async function generateMetadata({
|
||||
params
|
||||
}: {
|
||||
params: { slug: string; locale: string };
|
||||
}): Promise<Metadata> {
|
||||
const category = await clientFetch(categoryQuery, params);
|
||||
|
||||
if (!category) return notFound();
|
||||
|
||||
return {
|
||||
title: category.seo.title || category.title,
|
||||
description: category.seo.description || category.description
|
||||
};
|
||||
}
|
||||
|
||||
interface CategoryPageParams {
|
||||
params: {
|
||||
locale: string;
|
||||
slug: string;
|
||||
};
|
||||
}
|
||||
|
||||
export default async function ProductPage({ params }: CategoryPageParams) {
|
||||
const category = await clientFetch(categoryQuery, params);
|
||||
|
||||
if (!category) return notFound();
|
||||
|
||||
const { title } = category;
|
||||
|
||||
return (
|
||||
<div className="mb-8 flex w-full flex-col px-4 lg:my-16 lg:px-8 2xl:px-16">
|
||||
<Text variant={'pageHeading'}>{title}</Text>
|
||||
</div>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user