diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-03-28 09:22:13 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-03-28 09:22:13 +0700 |
| commit | 8ca9069251873e87338f1c7f581b418bebb11e9a (patch) | |
| tree | 12e651361cb667c768961932a99d0a253ffee4e7 /src/lib/product/components/ProductSearch.jsx | |
| parent | fd2a6bcf2f17a6dbcbfb3ca04ebf2c4d66d43437 (diff) | |
| parent | a040418bdddd5fcaf8a8d67e0a66ea92fd16ee24 (diff) | |
Merge branch 'master' of https://bitbucket.org/altafixco/next-indoteknik
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
| -rw-r--r-- | src/lib/product/components/ProductSearch.jsx | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 3078eac5..b5d7c974 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -10,7 +10,6 @@ import useActive from '@/core/hooks/useActive' import MobileView from '@/core/components/views/MobileView' import DesktopView from '@/core/components/views/DesktopView' import NextImage from 'next/image' -import { ChevronDownIcon } from '@heroicons/react/24/outline' import ProductFilterDesktop from './ProductFilterDesktop' import { useRouter } from 'next/router' @@ -43,7 +42,6 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { ) const [open, setOpen] = useState(1) - const [order, setOrder] = useState(query?.orderBy) const handleOpen = (value) => { setOpen(open === value ? 0 : value) @@ -55,15 +53,15 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { { value: 'stock', label: 'Ready Stock' } ] - const handleOrderBy = (e) => { + const handleOrderBy = (e) => { let params = { ...router.query, - orderBy: e.target.value - } - params = _.pickBy(params, _.identity) - params = toQuery(params) - router.push(`${prefixUrl}?${params}`) - } + orderBy: e.target.value + } + params = _.pickBy(params, _.identity) + params = toQuery(params) + router.push(`${prefixUrl}?${params}`) + } useEffect(() => { if (!products) { @@ -109,21 +107,13 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { )} </div> - <button - className='btn-light mb-6 py-2 px-5' - onClick={popup.activate} - > + <button className='btn-light mb-6 py-2 px-5' onClick={popup.activate}> Filter </button> <div className='grid grid-cols-2 gap-3'> {products && - products.map((product) => ( - <ProductCard - product={product} - key={product.id} - /> - ))} + products.map((product) => <ProductCard product={product} key={product.id} />)} </div> <Pagination @@ -184,17 +174,6 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { )} </div> <div className='justify-end flex '> - {/* <div> - <select - name='jumlah-baris' - className='form-input mt-2' - > - <option value=''>Jumlah Baris</option> - {orderOptions.map((option, index) => ( - <option value={option.value}> {option.label} </option> - ))} - </select> - </div> */} <div className='ml-3'> <select name='urutan' @@ -203,7 +182,10 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { > <option value=''>Urutkan</option> {orderOptions.map((option, index) => ( - <option value={option.value}> {option.label} </option> + <option key={index} value={option.value}> + {' '} + {option.label}{' '} + </option> ))} </select> </div> @@ -211,12 +193,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { </div> <div className='grid grid-cols-5 gap-x-3 gap-y-6'> {products && - products.map((product) => ( - <ProductCard - product={product} - key={product.id} - /> - ))} + products.map((product) => <ProductCard product={product} key={product.id} />)} </div> <div className='flex justify-between items-center mt-6 mb-2'> <div className='pt-2 pb-6 flex items-center gap-x-3'> @@ -229,10 +206,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { <div className='text-gray_r-12/90'> <span> Barang yang anda cari tidak ada?{' '} - <a - href='#' - className='text-red_r-9' - > + <a href='#' className='text-red_r-9'> Hubungi Kami </a> </span> |
