From 949a03f9a12b17fad85ecc58baad6352ba98d04d Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Mon, 27 Mar 2023 13:41:19 +0700
Subject: fix dark mode

---
 src/lib/product/components/ProductSearch.jsx | 56 ++++++++--------------------
 1 file changed, 15 insertions(+), 41 deletions(-)

(limited to 'src/lib/product/components/ProductSearch.jsx')

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>
-- 
cgit v1.2.3

