summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/product/components/ProductFilterDesktop.jsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/product/components/ProductFilterDesktop.jsx b/src/lib/product/components/ProductFilterDesktop.jsx
index e84d6526..6118ed6b 100644
--- a/src/lib/product/components/ProductFilterDesktop.jsx
+++ b/src/lib/product/components/ProductFilterDesktop.jsx
@@ -29,6 +29,7 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu
const [priceTo, setPriceTo] = useState(query?.priceTo)
const [stock, setStock] = useState(query?.stock)
const [activeRange, setActiveRange] = useState(null)
+ const [activeIndeces, setActiveIndeces] = useState([])
const priceRange = [
{
@@ -49,6 +50,10 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu
}
]
+ const indexRange = priceRange.findIndex((range) => {
+ return range.priceFrom === parseInt(priceFrom) && range.priceTo == parseInt(priceTo)
+ })
+
const handleCategoriesChange = (event) => {
const value = event.target.value
const isChecked = event.target.checked
@@ -108,6 +113,26 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu
}
}
+ /*const handleIndexAccordion = async () => {
+ if (brandValues) {
+ await setActiveIndeces([...activeIndeces, 0])
+ }
+ if (categoryValues) {
+ await setActiveIndeces([...activeIndeces, !router.pathname.includes('brands') ? 1 : 0])
+ }
+ if (priceRange) {
+ await setActiveIndeces([...activeIndeces, !router.pathname.includes('brands') ? 2 : 1])
+ }
+ if (stock) {
+ await setActiveIndeces([...activeIndeces, !router.pathname.includes('brands') ? 3 : 2])
+ }
+ }*/
+
+ useEffect(() => {
+ setActiveRange(indexRange)
+ }, [])
+
+
return (
<>
<Accordion defaultIndex={[0]} allowMultiple>