From 6bbe1668e0df94e2f75ca0c8df5730df2fa8cee1 Mon Sep 17 00:00:00 2001 From: Kristian Duda Date: Fri, 28 Jun 2024 21:43:53 +0200 Subject: [PATCH] sort --- app/search/[collection]/page.tsx | 4 ++-- app/search/layout.tsx | 4 +++- app/search/page.tsx | 4 ++-- lib/constants.ts | 32 ++++++++++++++++++++------------ lib/shopify/index.ts | 21 +++++++++++++++++---- 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/app/search/[collection]/page.tsx b/app/search/[collection]/page.tsx index e25542bfc..f3a7a0222 100644 --- a/app/search/[collection]/page.tsx +++ b/app/search/[collection]/page.tsx @@ -4,7 +4,7 @@ import { notFound } from 'next/navigation'; import Grid from 'components/grid'; import ProductGridItems from 'components/layout/product-grid-items'; -import { defaultSort, sorting } from 'lib/constants'; +import { DEFAULT_SORT, SORTING } from 'lib/constants'; export async function generateMetadata({ params @@ -30,7 +30,7 @@ export default async function CategoryPage({ searchParams?: { [key: string]: string | string[] | undefined }; }) { const { sort } = searchParams as { [key: string]: string }; - const { sortKey, reverse } = sorting.find((item) => item.slug === sort) || defaultSort; + const { sortKey, reverse } = SORTING.find((item) => item.slug === sort) || DEFAULT_SORT; const products = await getCollectionProducts({ collection: params.collection, sortKey, reverse }); return ( diff --git a/app/search/layout.tsx b/app/search/layout.tsx index 39bb38220..e9823a582 100644 --- a/app/search/layout.tsx +++ b/app/search/layout.tsx @@ -1,5 +1,7 @@ import Footer from 'components/layout/footer'; import Collections from 'components/layout/search/collections'; +import FilterList from 'components/layout/search/filter'; +import { SORTING } from 'lib/constants'; export default function SearchLayout({ children }: { children: React.ReactNode }) { return ( @@ -10,7 +12,7 @@ export default function SearchLayout({ children }: { children: React.ReactNode }
{children}
- {/* */} +