From d1ec47e89c38c4f056b673382aff07d81a341d45 Mon Sep 17 00:00:00 2001 From: Garima Date: Wed, 7 Aug 2024 17:39:44 +0530 Subject: [PATCH 1/2] feat: Update filters for product listing page - Replace dollar sign with rupee sign in price filter - Fix rating filter to correctly filter products based on rating value - Ensure filters accept and handle integer values correctly - Improve filter styling and structure --- .../components/Popular_Categories/Filters.jsx | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/User/components/Popular_Categories/Filters.jsx b/src/User/components/Popular_Categories/Filters.jsx index c74f768b..bfcdfecd 100644 --- a/src/User/components/Popular_Categories/Filters.jsx +++ b/src/User/components/Popular_Categories/Filters.jsx @@ -30,15 +30,30 @@ function Filters({ setCategoryFilter(e.target.value)} /> @@ -51,8 +66,12 @@ function Filters({ {/* Filter section for Rating */} setRatingFilter(parseInt(e.target.value))} + options={["1", "2", "3", "4", "5"]} + onChange={(e) => { + const value = parseInt(e.target.value, 10); //converting into int from decimal + setRatingFilter(isNaN(value) ? 0.00 : value); //applying condition for rating or higher + } + } /> @@ -68,7 +87,7 @@ function FilterSection({ title, options, onChange }) { {options.map((option) => ( ))} From b78d1ad9e8d4ddea5f45d65129e29d36341dad99 Mon Sep 17 00:00:00 2001 From: Garima <141991095+techy4shri@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:11:58 +0530 Subject: [PATCH 2/2] Update Filters.jsx modified code to avoid boundary errors --- src/User/components/Popular_Categories/Filters.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/User/components/Popular_Categories/Filters.jsx b/src/User/components/Popular_Categories/Filters.jsx index bfcdfecd..34b8c4cc 100644 --- a/src/User/components/Popular_Categories/Filters.jsx +++ b/src/User/components/Popular_Categories/Filters.jsx @@ -69,7 +69,7 @@ function Filters({ options={["1", "2", "3", "4", "5"]} onChange={(e) => { const value = parseInt(e.target.value, 10); //converting into int from decimal - setRatingFilter(isNaN(value) ? 0.00 : value); //applying condition for rating or higher + setRatingFilter(Number.isNaN(value) ? 0.00 : value); //applying condition for rating or higher } } />