mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Restructured app to work better with localized slugs
This commit is contained in:
34
app/[locale]/[...slug]/components/category-page.tsx
Normal file
34
app/[locale]/[...slug]/components/category-page.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import Search from '@/components/search/search';
|
||||
import SearchResult from '@/components/search/search-result';
|
||||
import Text from '@/components/ui/text/text';
|
||||
import { clientFetch } from '@/lib/sanity/sanity.client';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
interface CategoryPageParams {
|
||||
query: string;
|
||||
queryParams: {
|
||||
slug: string;
|
||||
locale: string;
|
||||
};
|
||||
}
|
||||
|
||||
export default async function CategoryPage({ query, queryParams }: CategoryPageParams) {
|
||||
const category = await clientFetch(query, queryParams);
|
||||
|
||||
if (!category) return notFound();
|
||||
|
||||
const { title } = category;
|
||||
|
||||
return (
|
||||
<div className="my-8 flex w-full flex-col px-4 lg:my-12 lg:px-8 2xl:px-16">
|
||||
{title && (
|
||||
<Text className="mb-8 lg:mb-12" variant="pageHeading">
|
||||
{title}
|
||||
</Text>
|
||||
)}
|
||||
<Search isCategory placeholder={title.toLowerCase()}>
|
||||
<SearchResult />
|
||||
</Search>
|
||||
</div>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user