From ba46cdd517ccbab85b52f886d16e3161cab2f8c8 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 28 Apr 2023 15:20:02 +0700
Subject: fix suggestion

---
 src/core/components/elements/Navbar/Search.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/core/components/elements/Navbar/Search.jsx')

diff --git a/src/core/components/elements/Navbar/Search.jsx b/src/core/components/elements/Navbar/Search.jsx
index 3046782b..8c2ed8d4 100644
--- a/src/core/components/elements/Navbar/Search.jsx
+++ b/src/core/components/elements/Navbar/Search.jsx
@@ -13,6 +13,7 @@ const Search = () => {
   const loadSuggestion = useCallback(() => {
     if (query && document.activeElement == queryRef.current) {
       searchSuggestApi({ query }).then((response) => {
+        console.table(response.data.suggestions);
         setSuggestions(response.data.suggestions)
       })
     } else {
@@ -60,7 +61,7 @@ const Search = () => {
           <MagnifyingGlassIcon className='w-6' />
         </button>
 
-        {suggestions.length > 1 && (
+        {suggestions.length > 0 && (
           <>
             <div className='absolute w-full top-[50px] rounded-b bg-gray_r-1 border border-gray_r-6 divide-y divide-gray_r-6 z-50'>
               {suggestions.map((suggestion, index) => (
-- 
cgit v1.2.3


From 2d9ef5366a35e658bc060d8ff8778dfaa6b68b03 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 28 Apr 2023 16:12:46 +0700
Subject: fix defat sort search

---
 src/core/components/elements/Navbar/Search.jsx | 1 -
 1 file changed, 1 deletion(-)

(limited to 'src/core/components/elements/Navbar/Search.jsx')

diff --git a/src/core/components/elements/Navbar/Search.jsx b/src/core/components/elements/Navbar/Search.jsx
index 8c2ed8d4..54eecf84 100644
--- a/src/core/components/elements/Navbar/Search.jsx
+++ b/src/core/components/elements/Navbar/Search.jsx
@@ -13,7 +13,6 @@ const Search = () => {
   const loadSuggestion = useCallback(() => {
     if (query && document.activeElement == queryRef.current) {
       searchSuggestApi({ query }).then((response) => {
-        console.table(response.data.suggestions);
         setSuggestions(response.data.suggestions)
       })
     } else {
-- 
cgit v1.2.3


From db5d67db219a6672848115b556fd572cdba7c60c Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 2 May 2023 15:14:18 +0700
Subject: fix product

---
 src/core/components/elements/Navbar/Search.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/core/components/elements/Navbar/Search.jsx')

diff --git a/src/core/components/elements/Navbar/Search.jsx b/src/core/components/elements/Navbar/Search.jsx
index 54eecf84..77510773 100644
--- a/src/core/components/elements/Navbar/Search.jsx
+++ b/src/core/components/elements/Navbar/Search.jsx
@@ -13,7 +13,7 @@ const Search = () => {
   const loadSuggestion = useCallback(() => {
     if (query && document.activeElement == queryRef.current) {
       searchSuggestApi({ query }).then((response) => {
-        setSuggestions(response.data.suggestions)
+        setSuggestions(response.data?.suggestions || [])
       })
     } else {
       setSuggestions([])
-- 
cgit v1.2.3


From 6e816fba49e020bfdc3f1ffa10183b585e87d9c1 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Thu, 4 May 2023 15:38:40 +0700
Subject: optimizing performance

---
 src/core/components/elements/Navbar/Search.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src/core/components/elements/Navbar/Search.jsx')

diff --git a/src/core/components/elements/Navbar/Search.jsx b/src/core/components/elements/Navbar/Search.jsx
index 77510773..47a9c235 100644
--- a/src/core/components/elements/Navbar/Search.jsx
+++ b/src/core/components/elements/Navbar/Search.jsx
@@ -56,7 +56,11 @@ const Search = () => {
           onBlur={onInputBlur}
           onFocus={loadSuggestion}
         />
-        <button type='submit' className='rounded-r border border-l-0 border-gray_r-6 px-2'>
+        <button
+          type='submit'
+          aria-label='SearchButton'
+          className='rounded-r border border-l-0 border-gray_r-6 px-2'
+        >
           <MagnifyingGlassIcon className='w-6' />
         </button>
 
-- 
cgit v1.2.3

