summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Navbar/Search.jsx
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-05-08 16:44:09 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-05-08 16:44:09 +0700
commit486f85a45fc7e0669576f59824a31be472ed25bb (patch)
tree0268afa8efe48746e040611ba41ad2cafda7ad08 /src/core/components/elements/Navbar/Search.jsx
parentcff198277e14450f8d20d9e18548325e6f277682 (diff)
parent30fc50600009ca54f085d594d838803c107e87f2 (diff)
Merge branch 'master' into development_tri/implementasi_raja_ongkir
# Conflicts: # src/lib/checkout/components/Checkout.jsx
Diffstat (limited to 'src/core/components/elements/Navbar/Search.jsx')
-rw-r--r--src/core/components/elements/Navbar/Search.jsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/components/elements/Navbar/Search.jsx b/src/core/components/elements/Navbar/Search.jsx
index 3046782b..47a9c235 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([])
@@ -56,11 +56,15 @@ 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>
- {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) => (