diff --git a/app/search/[collection]/page.tsx b/app/search/[collection]/page.tsx index 860dfea79..8cc6f3e14 100644 --- a/app/search/[collection]/page.tsx +++ b/app/search/[collection]/page.tsx @@ -1,4 +1,4 @@ -import { getCollection, getCollectionProducts, getMenu } from 'lib/shopify'; +import { getCollection, getCollectionProducts } from 'lib/shopify'; import { Metadata } from 'next'; import { notFound } from 'next/navigation'; @@ -9,6 +9,8 @@ import ProductGridItems from 'components/layout/product-grid-items'; import FiltersList from 'components/layout/search/filters/filters-list'; import MobileFilters from 'components/layout/search/filters/mobile-filters'; import SubMenu from 'components/layout/search/filters/sub-menu'; +import Header, { HeaderPlaceholder } from 'components/layout/search/header'; +import ProductsGridPlaceholder from 'components/layout/search/placeholder'; import SortingMenu from 'components/layout/search/sorting-menu'; import { AVAILABILITY_FILTER_ID, @@ -90,7 +92,7 @@ const constructFilterInput = (filters: { return results; }; -export default async function CategoryPage({ +async function CategoryPage({ params, searchParams }: { @@ -101,42 +103,23 @@ export default async function CategoryPage({ const { sortKey, reverse } = sorting.find((item) => item.slug === sort) || defaultSort; const filtersInput = constructFilterInput(rest); - const productsData = getCollectionProducts({ + const { products, filters } = await getCollectionProducts({ collection: params.collection, sortKey, reverse, ...(filtersInput.length ? { filters: filtersInput } : {}) }); - const collectionData = getCollection(params.collection); - const menuData = getMenu('main-menu'); - - const [{ products, filters }, collection, menu] = await Promise.all([ - productsData, - collectionData, - menuData - ]); return ( <> -
- }> - - -
- {collection ? ( -
-

{collection.title}

-

{collection.description}

-
- ) : null}
- + } />
@@ -154,3 +137,24 @@ export default async function CategoryPage({ ); } + +export default function CategorySearchPage(props: { + params: { collection: string }; + searchParams?: { [key: string]: string | string[] | undefined }; +}) { + return ( + <> +
+ }> + + +
+ }> +
+ + }> + + + + ); +} diff --git a/app/search/layout.tsx b/app/search/layout.tsx index 7bdb8cf47..786aee999 100644 --- a/app/search/layout.tsx +++ b/app/search/layout.tsx @@ -1,11 +1,12 @@ import Footer from 'components/layout/footer'; -import { Suspense } from 'react'; export default function SearchLayout({ children }: { children: React.ReactNode }) { return ( - -
{children}
+ <> +
+ {children} +