From ce6410c50815c4921d8a6bc11b3ba5393e554732 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sat, 29 Jul 2023 14:54:46 +0300 Subject: [PATCH] feat: Implement search functionality to filter products based on search text and product type feat: Add sorting options to filter products by price (low to high and high to low) feat: Add pagination to display a limited number of products per page refactor: Use destructured import for product API query style: Update the design and layout of the search results page fix: Handle edge case when no products match the search criteria --- src/layout/headers/header-2.jsx | 2 +- src/layout/headers/header.jsx | 2 +- src/pages/search.jsx | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layout/headers/header-2.jsx b/src/layout/headers/header-2.jsx index 48cba4a..2f35cca 100644 --- a/src/layout/headers/header-2.jsx +++ b/src/layout/headers/header-2.jsx @@ -41,7 +41,7 @@ const HeaderTwo = ({ style_2 = false }) => { - +(402) 763 282 46 + +(966) 595 035 008 diff --git a/src/layout/headers/header.jsx b/src/layout/headers/header.jsx index 817abe4..e7faf54 100644 --- a/src/layout/headers/header.jsx +++ b/src/layout/headers/header.jsx @@ -111,7 +111,7 @@ const Header = () => {
Hotline:

- +(402) 763 282 46 + +(966) 595 035 008

diff --git a/src/pages/search.jsx b/src/pages/search.jsx index 46006ff..d87ce5e 100644 --- a/src/pages/search.jsx +++ b/src/pages/search.jsx @@ -49,13 +49,13 @@ export default function SearchPage({ query }) { if (searchText && !productType) { product_items = all_products.filter((prd) => - prd.title.toLowerCase().includes(searchText.toLowerCase()) + prd.title?.toLowerCase().includes(searchText?.toLowerCase()) ); } if (searchText && productType) { product_items = all_products.filter( - (prd) => prd.productType.toLowerCase() === productType.toLowerCase() - ).filter(p => p.title.toLowerCase().includes(searchText.toLowerCase())); + (prd) => prd.productType?.toLowerCase() === productType?.toLowerCase() + ).filter(p => p?.title?.toLowerCase().includes(searchText?.toLowerCase())); } // Price low to high if (shortValue === "Price low to high") {