From f15a7f8a4387d215abd1051ee520adca8944fa05 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 28 Mar 2023 16:32:45 +0700
Subject: checkout, quotation

---
 src/lib/product/components/ProductSearch.jsx | 12 +++---------
 1 file changed, 3 insertions(+), 9 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 b5d7c974..b00d68a4 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -41,11 +41,6 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
     }
   )
 
-  const [open, setOpen] = useState(1)
-
-  const handleOpen = (value) => {
-    setOpen(open === value ? 0 : value)
-  }
   const orderOptions = [
     { value: 'price-asc', label: 'Harga Terendah' },
     { value: 'price-desc', label: 'Harga Tertinggi' },
@@ -69,13 +64,10 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
     }
   }, [query, products, productSearch])
 
-  if (productSearch.isLoading) {
-    return <ProductSearchSkeleton />
-  }
-
   return (
     <>
       <MobileView>
+        {productSearch.isLoading && <ProductSearchSkeleton />}
         <div className='p-4'>
           <h1 className='mb-2 font-semibold text-h-sm'>Produk</h1>
 
@@ -178,6 +170,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
                   <select
                     name='urutan'
                     className='form-input mt-2'
+                    value={router.query?.orderBy || ''}
                     onChange={(e) => handleOrderBy(e)}
                   >
                     <option value=''>Urutkan</option>
@@ -191,6 +184,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
                 </div>
               </div>
             </div>
+            {productSearch.isLoading && <ProductSearchSkeleton />}
             <div className='grid grid-cols-5 gap-x-3 gap-y-6'>
               {products &&
                 products.map((product) => <ProductCard product={product} key={product.id} />)}
-- 
cgit v1.2.3

