Commit d2afd71c authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

fix: change from flex to inline to fix safari bugs (#4559)

change from flex to inline to fix safari bugs
Co-authored-by: default avatarCharlie <charlie@uniswap.org>
parent bad1ce26
...@@ -27,6 +27,7 @@ export const searchBarContainer = style([ ...@@ -27,6 +27,7 @@ export const searchBarContainer = style([
right: '0', right: '0',
top: '0', top: '0',
zIndex: '3', zIndex: '3',
display: 'inline-block',
}), }),
{ {
'@media': { '@media': {
......
...@@ -332,64 +332,62 @@ export const SearchBar = () => { ...@@ -332,64 +332,62 @@ 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 position="relative"> <Box
<Box position={isOpen ? { sm: 'fixed', md: 'absolute' } : 'static'}
position={isOpen ? { sm: 'fixed', md: 'absolute' } : 'static'} width={{ sm: isOpen ? 'viewWidth' : 'auto', md: 'auto' }}
width={{ sm: isOpen ? 'viewWidth' : 'auto', md: 'auto' }} ref={searchRef}
ref={searchRef} className={styles.searchBarContainer}
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"
> >
<Row <Box display={{ sm: 'none', md: 'flex' }}>
className={clsx(`${styles.searchBar} ${!isOpen && magicalGradientOnHover}`)} <MagnifyingGlassIcon />
borderRadius={isOpen ? undefined : '12'} </Box>
borderTopRightRadius={isOpen && !isMobile ? '12' : undefined} <Box display={{ sm: 'flex', md: 'none' }} color="placeholder" onClick={toggleOpen}>
borderTopLeftRadius={isOpen && !isMobile ? '12' : undefined} <ChevronLeftIcon />
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>
{isOpen && <Box
(debouncedSearchValue.length > 0 && (tokensAreLoading || collectionsAreLoading) ? ( as="input"
<SkeletonRow /> placeholder={placeholderText}
) : ( width={isOpen || phase1Flag === NftVariant.Enabled ? 'full' : '120'}
<SearchBarDropdown onChange={(event: ChangeEvent<HTMLInputElement>) => {
toggleOpen={toggleOpen} !isOpen && toggleOpen()
tokens={reducedTokens} setSearchValue(event.target.value)
collections={reducedCollections} }}
hasInput={debouncedSearchValue.length > 0} 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>
{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