summaryrefslogtreecommitdiff
path: root/src/lib/product/components
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-11 15:08:29 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-11 15:08:29 +0700
commite4bce35fe6ec891bb8841bbfad981e97f5bb2aa8 (patch)
tree4c3326c14a5bdbf2701eb67ccf0cd08264f431da /src/lib/product/components
parentde61c739202db29270d4ffd9215091f0219aba8c (diff)
filter page brand
Diffstat (limited to 'src/lib/product/components')
-rw-r--r--src/lib/product/components/ProductFilter.jsx39
-rw-r--r--src/lib/product/components/ProductFilterDesktop.jsx60
2 files changed, 53 insertions, 46 deletions
diff --git a/src/lib/product/components/ProductFilter.jsx b/src/lib/product/components/ProductFilter.jsx
index 20c66a1f..40bfc824 100644
--- a/src/lib/product/components/ProductFilter.jsx
+++ b/src/lib/product/components/ProductFilter.jsx
@@ -87,24 +87,27 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr
return (
<BottomPopup active={active} close={close} title='Filter Produk'>
<div className='flex flex-col gap-y-4'>
- {!defaultBrand && (
- <div>
- <label>Brand</label>
- <select
- name='brand'
- className='form-input mt-2'
- value={brand}
- onChange={(e) => setBrand(e.target.value)}
- >
- <option value=''>Pilih Brand...</option>
- {brands.map((brand, index) => (
- <option value={brand.brand} key={index}>
- {brand.brand} <span className='text-sm text-gray-200'>({brand.qty})</span>
- </option>
- ))}
- </select>
- </div>
- )}
+ {!router.pathname.includes('brands') &&
+ !defaultBrand && (
+ <div>
+ <label>Brand</label>
+ <select
+ name='brand'
+ className='form-input mt-2'
+ value={brand}
+ onChange={(e) => setBrand(e.target.value)}
+ >
+ <option value=''>Pilih Brand...</option>
+ {brands.map((brand, index) => (
+ <option value={brand.brand} key={index}>
+ {brand.brand} <span className='text-sm text-gray-200'>({brand.qty})</span>
+ </option>
+ ))}
+ </select>
+ </div>
+ )
+ }
+
<div>
<label>Kategori</label>
<select
diff --git a/src/lib/product/components/ProductFilterDesktop.jsx b/src/lib/product/components/ProductFilterDesktop.jsx
index 7adf58cd..cdfd85e8 100644
--- a/src/lib/product/components/ProductFilterDesktop.jsx
+++ b/src/lib/product/components/ProductFilterDesktop.jsx
@@ -17,6 +17,7 @@ import {
Stack,
VStack
} from '@chakra-ui/react'
+import Image from '@/core/components/elements/Image/Image'
const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = null }) => {
const router = useRouter()
@@ -110,34 +111,37 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu
return (
<>
<Accordion defaultIndex={[0]} allowMultiple>
- <AccordionItem>
- <AccordionButton padding={[2, 4]}>
- <Box as='span' flex='1' textAlign='left' fontWeight='semibold'>
- Brand
- </Box>
- <AccordionIcon />
- </AccordionButton>
-
- <AccordionPanel>
- <Stack gap={3} direction='column' maxH={'240px'} overflow='auto'>
- {brands.map((brand, index) => (
- <div className='flex items-center gap-2 ' key={index}>
- <Checkbox
- isChecked={brandValues.includes(brand.brand)}
- onChange={handleBrandsChange}
- value={brand.brand}
- size='md'
- >
- <div className='flex items-center gap-2'>
- <span>{brand.brand} </span>
- <span className='text-sm text-gray-600'>({brand.qty})</span>
- </div>
- </Checkbox>
- </div>
- ))}
- </Stack>
- </AccordionPanel>
- </AccordionItem>
+
+ {!router.pathname.includes('brands') && (
+ <AccordionItem>
+ <AccordionButton padding={[2, 4]}>
+ <Box as='span' flex='1' textAlign='left' fontWeight='semibold'>
+ Brand
+ </Box>
+ <AccordionIcon />
+ </AccordionButton>
+
+ <AccordionPanel>
+ <Stack gap={3} direction='column' maxH={'240px'} overflow='auto'>
+ {brands.map((brand, index) => (
+ <div className='flex items-center gap-2 ' key={index}>
+ <Checkbox
+ isChecked={brandValues.includes(brand.brand)}
+ onChange={handleBrandsChange}
+ value={brand.brand}
+ size='md'
+ >
+ <div className='flex items-center gap-2'>
+ <span>{brand.brand} </span>
+ <span className='text-sm text-gray-600'>({brand.qty})</span>
+ </div>
+ </Checkbox>
+ </div>
+ ))}
+ </Stack>
+ </AccordionPanel>
+ </AccordionItem>
+ )}
<AccordionItem>
<AccordionButton padding={[2, 4]}>