Commit 98d4e108 authored by Jack Short's avatar Jack Short Committed by GitHub

fix: search icon bug (#4556)

parent ab43ed19
...@@ -332,62 +332,64 @@ export const SearchBar = () => { ...@@ -332,62 +332,64 @@ export const SearchBar = () => {
const placeholderText = phase1Flag === NftVariant.Enabled ? t`Search tokens and NFT collections` : t`Search tokens` const placeholderText = phase1Flag === NftVariant.Enabled ? t`Search tokens and NFT collections` : t`Search tokens`
return ( return (
<Box position="relative"> <>
<Box <Box position="relative">
position={isOpen ? { sm: 'fixed', md: 'absolute' } : 'static'} <Box
width={{ sm: isOpen ? 'viewWidth' : 'auto', md: 'auto' }} position={isOpen ? { sm: 'fixed', md: 'absolute' } : 'static'}
ref={searchRef} width={{ sm: isOpen ? 'viewWidth' : 'auto', md: 'auto' }}
className={styles.searchBarContainer} ref={searchRef}
> className={styles.searchBarContainer}
<Row
className={clsx(`${styles.searchBar} ${!isOpen && magicalGradientOnHover}`)}
borderRadius={isOpen ? undefined : '12'}
borderTopRightRadius={isOpen && !isMobile ? '12' : undefined}
borderTopLeftRadius={isOpen && !isMobile ? '12' : undefined}
borderBottomWidth={isOpen ? '0px' : '1px'}
display={{ sm: isOpen ? 'flex' : 'none', xl: 'flex' }}
justifyContent={isOpen || phase1Flag === NftVariant.Enabled ? 'flex-start' : 'center'}
onFocus={() => !isOpen && toggleOpen()}
onClick={() => !isOpen && toggleOpen()}
gap="12"
> >
<Box display={{ sm: 'none', md: 'flex' }}> <Row
<MagnifyingGlassIcon /> className={clsx(`${styles.searchBar} ${!isOpen && magicalGradientOnHover}`)}
</Box> borderRadius={isOpen ? undefined : '12'}
<Box display={{ sm: 'flex', md: 'none' }} color="placeholder" onClick={toggleOpen}> borderTopRightRadius={isOpen && !isMobile ? '12' : undefined}
<ChevronLeftIcon /> borderTopLeftRadius={isOpen && !isMobile ? '12' : undefined}
borderBottomWidth={isOpen ? '0px' : '1px'}
display={{ sm: isOpen ? 'flex' : 'none', xl: 'flex' }}
justifyContent={isOpen || phase1Flag === NftVariant.Enabled ? 'flex-start' : 'center'}
onFocus={() => !isOpen && toggleOpen()}
onClick={() => !isOpen && toggleOpen()}
gap="12"
>
<Box display={{ sm: 'none', md: 'flex' }}>
<MagnifyingGlassIcon />
</Box>
<Box display={{ sm: 'flex', md: 'none' }} color="placeholder" onClick={toggleOpen}>
<ChevronLeftIcon />
</Box>
<Box
as="input"
placeholder={placeholderText}
width={isOpen || phase1Flag === NftVariant.Enabled ? 'full' : '120'}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
!isOpen && toggleOpen()
setSearchValue(event.target.value)
}}
className={styles.searchBarInput}
value={searchValue}
ref={inputRef}
/>
</Row>
<Box display={{ sm: isOpen ? 'none' : 'flex', xl: 'none' }}>
<NavIcon onClick={toggleOpen}>
<NavMagnifyingGlassIcon width={28} height={28} />
</NavIcon>
</Box> </Box>
<Box {isOpen &&
as="input" (debouncedSearchValue.length > 0 && (tokensAreLoading || collectionsAreLoading) ? (
placeholder={placeholderText} <SkeletonRow />
width={isOpen || phase1Flag === NftVariant.Enabled ? 'full' : '120'} ) : (
onChange={(event: ChangeEvent<HTMLInputElement>) => { <SearchBarDropdown
!isOpen && toggleOpen() toggleOpen={toggleOpen}
setSearchValue(event.target.value) tokens={reducedTokens}
}} collections={reducedCollections}
className={styles.searchBarInput} hasInput={debouncedSearchValue.length > 0}
value={searchValue} />
ref={inputRef} ))}
/>
</Row>
<Box display={{ sm: isOpen ? 'none' : 'flex', xl: 'none' }}>
<NavIcon onClick={toggleOpen}>
<NavMagnifyingGlassIcon width={28} height={28} />
</NavIcon>
</Box> </Box>
{isOpen &&
(debouncedSearchValue.length > 0 && (tokensAreLoading || collectionsAreLoading) ? (
<SkeletonRow />
) : (
<SearchBarDropdown
toggleOpen={toggleOpen}
tokens={reducedTokens}
collections={reducedCollections}
hasInput={debouncedSearchValue.length > 0}
/>
))}
</Box> </Box>
{isOpen && <Overlay />} {isOpen && <Overlay />}
</Box> </>
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment