From 616e9292cd1db6bbc0cd28208e5403dd667152b9 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 27 Sep 2023 14:05:15 +0700
Subject: Update with chakra UI theme

---
 src/lib/product/components/ProductSearch.jsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 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 ae9618d2..df9aa91b 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -39,9 +39,11 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
         const oddIndexSuggestions = response.data.spellcheck.suggestions.filter(
           (_, index) => index % 2 === 1
         )
+
         const oddIndexCollations = response.data.spellcheck.collations.filter(
           (_, index) => index % 2 === 1
         )
+
         const dataSpellings = oddIndexSuggestions.reduce((acc, curr) => {
           oddIndexCollations.forEach((collation) => {
             acc.push(collation.collationQuery)
@@ -52,7 +54,9 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
           return acc
         }, [])
 
-        setQ(dataSpellings[0])
+        if (dataSpellings.length > 0) {
+          setQ(dataSpellings[0])
+        }
 
         setSpellings(dataSpellings)
       })
@@ -183,7 +187,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
               defaultBrand={defaultBrand}
             />
           </div>
-          <div className='w-9/12 p-3'>
+          <div className='w-9/12 pl-6'>
             <h1 className='text-2xl mb-2 font-semibold'>Hasil Pencarian</h1>
             <div className='flex justify-between items-center mb-2'>
               <div className='mb-2 leading-6 text-gray_r-11'>
-- 
cgit v1.2.3

