summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductSearch.jsx
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-09-27 14:05:15 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-09-27 14:05:15 +0700
commit616e9292cd1db6bbc0cd28208e5403dd667152b9 (patch)
treeb212eb9bccb43bcc9070c0a93059034ec1cf998c /src/lib/product/components/ProductSearch.jsx
parent81787db3eddc401e40304286e4d01cf60a7ea3d0 (diff)
Update with chakra UI theme
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
-rw-r--r--src/lib/product/components/ProductSearch.jsx8
1 files changed, 6 insertions, 2 deletions
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'>