import Grid from "components/grid"; import ProductGridItems from "components/layout/product-grid-items"; import { getCollectionProducts } from "lib/store/products"; import { Metadata } from "next"; const defaultSort = { sortKey: "RELEVANCE", reverse: false, }; export const metadata: Metadata = { title: "Search", description: "Search the collection.", }; export default async function CategoryPage(props: { params: Promise<{ collection: string }>; searchParams?: Promise<{ [key: string]: string | string[] | undefined }>; }) { const searchParams = await props.searchParams; const params = await props.params; const { sort } = searchParams as { [key: string]: string }; const { sortKey, reverse } = defaultSort; const products = await getCollectionProducts({ collection: params.collection, sortKey, reverse, }); return (
{products.length === 0 ? (

{`No products found in this collection`}

) : ( )}
); }