Commit 9381a74f authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

feat: nav update to new responsive designs (#4542)

* uppdated mobile nav

* adjust searchbar for new styles
Co-authored-by: default avatarCharlie <charlie@uniswap.org>
parent f6662a32
...@@ -108,14 +108,14 @@ export const ChainSwitcher = ({ leftAlign }: ChainSwitcherProps) => { ...@@ -108,14 +108,14 @@ export const ChainSwitcher = ({ leftAlign }: ChainSwitcherProps) => {
{!isSupported ? ( {!isSupported ? (
<> <>
<TokenWarningRedIcon fill={themeVars.colors.darkGray} width={24} height={24} /> <TokenWarningRedIcon fill={themeVars.colors.darkGray} width={24} height={24} />
<Box as="span" className={subhead} display={{ sm: 'none', xl: 'flex' }} style={{ lineHeight: '20px' }}> <Box as="span" className={subhead} display={{ sm: 'none', xxl: 'flex' }} style={{ lineHeight: '20px' }}>
Unsupported Unsupported
</Box> </Box>
</> </>
) : ( ) : (
<> <>
<img src={info.logoUrl} alt={info.label} className={styles.Image} /> <img src={info.logoUrl} alt={info.label} className={styles.Image} />
<Box as="span" className={subhead} display={{ sm: 'none', xl: 'flex' }} style={{ lineHeight: '20px' }}> <Box as="span" className={subhead} display={{ sm: 'none', xxl: 'flex' }} style={{ lineHeight: '20px' }}>
{info.label} {info.label}
</Box> </Box>
</> </>
......
...@@ -130,7 +130,7 @@ export const MenuDropdown = () => { ...@@ -130,7 +130,7 @@ export const MenuDropdown = () => {
</NavIcon> </NavIcon>
{isOpen && ( {isOpen && (
<NavDropdown top={{ sm: 'unset', xxl: '56' }} bottom={{ sm: '56', xxl: 'unset' }} right="0"> <NavDropdown top={{ sm: 'unset', lg: '56' }} bottom={{ sm: '56', lg: 'unset' }} right="0">
<Column gap="16"> <Column gap="16">
<Column paddingX="8" gap="4"> <Column paddingX="8" gap="4">
{nftFlag === NftVariant.Enabled && ( {nftFlag === NftVariant.Enabled && (
......
...@@ -19,6 +19,6 @@ export const navIcon = style([ ...@@ -19,6 +19,6 @@ export const navIcon = style([
':hover': { ':hover': {
background: vars.color.lightGrayOverlay, background: vars.color.lightGrayOverlay,
}, },
zIndex: 2, zIndex: 1,
}, },
]) ])
...@@ -61,7 +61,7 @@ export const middleContainer = style([ ...@@ -61,7 +61,7 @@ export const middleContainer = style([
flex: '1', flex: '1',
flexShrink: '1', flexShrink: '1',
justifyContent: 'center', justifyContent: 'center',
display: { sm: 'none', lg: 'flex' }, display: { sm: 'none', xl: 'flex' },
}), }),
]) ])
...@@ -109,7 +109,7 @@ export const activeMenuItem = style([ ...@@ -109,7 +109,7 @@ export const activeMenuItem = style([
export const mobileBottomBar = style([ export const mobileBottomBar = style([
sprinkles({ sprinkles({
position: 'fixed', position: 'fixed',
display: { sm: 'flex', xxl: 'none' }, display: { sm: 'flex', lg: 'none' },
bottom: '0', bottom: '0',
right: '0', right: '0',
left: '0', left: '0',
......
...@@ -72,10 +72,10 @@ const Navbar = () => { ...@@ -72,10 +72,10 @@ const Navbar = () => {
<Box as="a" href="#/swap" className={styles.logoContainer}> <Box as="a" href="#/swap" className={styles.logoContainer}>
<UniIcon width="48" height="48" className={styles.logo} /> <UniIcon width="48" height="48" className={styles.logo} />
</Box> </Box>
<Box display={{ sm: 'flex', xxl: 'none' }}> <Box display={{ sm: 'flex', lg: 'none' }}>
<ChainSwitcher leftAlign={true} /> <ChainSwitcher leftAlign={true} />
</Box> </Box>
<Row gap="8" display={{ sm: 'none', xxl: 'flex' }}> <Row gap="8" display={{ sm: 'none', lg: 'flex' }}>
<PageTabs /> <PageTabs />
</Row> </Row>
</Box> </Box>
...@@ -84,13 +84,13 @@ const Navbar = () => { ...@@ -84,13 +84,13 @@ const Navbar = () => {
</Box> </Box>
<Box className={styles.rightSideContainer}> <Box className={styles.rightSideContainer}>
<Row gap="12"> <Row gap="12">
<Box display={{ sm: 'flex', lg: 'none' }}> <Box display={{ sm: 'flex', xl: 'none' }}>
<SearchBar /> <SearchBar />
</Box> </Box>
<Box display={{ sm: 'none', xxl: 'flex' }}> <Box display={{ sm: 'none', lg: 'flex' }}>
<MenuDropdown /> <MenuDropdown />
</Box> </Box>
<Box display={{ sm: 'none', xxl: 'flex' }}> <Box display={{ sm: 'none', lg: 'flex' }}>
<ChainSwitcher /> <ChainSwitcher />
</Box> </Box>
......
...@@ -3,7 +3,7 @@ import { buttonTextSmall, subhead, subheadSmall } from 'nft/css/common.css' ...@@ -3,7 +3,7 @@ import { buttonTextSmall, subhead, subheadSmall } from 'nft/css/common.css'
import { breakpoints, sprinkles, vars } from '../../nft/css/sprinkles.css' import { breakpoints, sprinkles, vars } from '../../nft/css/sprinkles.css'
const DESKTOP_NAVBAR_WIDTH = '360px' const DESKTOP_NAVBAR_WIDTH = 360
const baseSearchStyle = style([ const baseSearchStyle = style([
sprinkles({ sprinkles({
...@@ -15,8 +15,26 @@ const baseSearchStyle = style([ ...@@ -15,8 +15,26 @@ const baseSearchStyle = style([
}), }),
{ {
'@media': { '@media': {
[`screen and (min-width: ${breakpoints.md}px)`]: { [`screen and (min-width: ${breakpoints.sm}px)`]: {
width: DESKTOP_NAVBAR_WIDTH, width: `${DESKTOP_NAVBAR_WIDTH}px`,
},
},
},
])
export const searchBarContainer = style([
sprinkles({
right: '0',
top: '0',
zIndex: '3',
}),
{
'@media': {
[`screen and (min-width: ${breakpoints.sm}px)`]: {
top: '-24px',
},
[`screen and (min-width: ${breakpoints.lg}px)`]: {
right: `-${DESKTOP_NAVBAR_WIDTH / 2}px`,
}, },
}, },
}, },
...@@ -48,9 +66,6 @@ export const searchBarInput = style([ ...@@ -48,9 +66,6 @@ export const searchBarInput = style([
export const searchBarDropdown = style([ export const searchBarDropdown = style([
baseSearchStyle, baseSearchStyle,
sprinkles({ sprinkles({
position: 'absolute',
left: '0',
top: '48',
borderBottomLeftRadius: '12', borderBottomLeftRadius: '12',
borderBottomRightRadius: '12', borderBottomRightRadius: '12',
background: 'lightGray', background: 'lightGray',
......
...@@ -323,30 +323,29 @@ export const SearchBar = () => { ...@@ -323,30 +323,29 @@ 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={{ sm: isOpen ? 'absolute' : 'relative', lg: 'relative' }} position={isOpen ? { sm: 'fixed', md: 'absolute' } : 'static'}
top={{ sm: '0', lg: 'unset' }} width={{ sm: isOpen ? 'viewWidth' : 'auto', md: 'auto' }}
left={{ sm: '0', lg: 'unset' }}
width={{ sm: isOpen ? 'viewWidth' : 'auto', lg: 'auto' }}
ref={searchRef} ref={searchRef}
style={{ zIndex: '1000' }} className={styles.searchBarContainer}
> >
<Row <Row
className={clsx(`${styles.searchBar} ${!isOpen && magicalGradientOnHover}`)} className={clsx(`${styles.searchBar} ${!isOpen && magicalGradientOnHover}`)}
borderRadius={isOpen ? undefined : '12'} borderRadius={isOpen ? undefined : '12'}
borderTopRightRadius={isOpen && !isMobile ? '12' : undefined} borderTopRightRadius={isOpen && !isMobile ? '12' : undefined}
borderTopLeftRadius={isOpen && !isMobile ? '12' : undefined} borderTopLeftRadius={isOpen && !isMobile ? '12' : undefined}
display={{ sm: isOpen ? 'flex' : 'none', lg: 'flex' }} borderBottomWidth={isOpen ? '0px' : '1px'}
display={{ sm: isOpen ? 'flex' : 'none', xl: 'flex' }}
justifyContent={isOpen || phase1Flag === NftVariant.Enabled ? 'flex-start' : 'center'} justifyContent={isOpen || phase1Flag === NftVariant.Enabled ? 'flex-start' : 'center'}
onFocus={() => !isOpen && toggleOpen()} onFocus={() => !isOpen && toggleOpen()}
onClick={() => !isOpen && toggleOpen()} onClick={() => !isOpen && toggleOpen()}
gap="12" gap="12"
> >
<Box display={{ sm: 'none', lg: 'flex' }}> <Box display={{ sm: 'none', md: 'flex' }}>
<MagnifyingGlassIcon /> <MagnifyingGlassIcon />
</Box> </Box>
<Box display={{ sm: 'flex', lg: 'none' }} color="placeholder" onClick={toggleOpen}> <Box display={{ sm: 'flex', md: 'none' }} color="placeholder" onClick={toggleOpen}>
<ChevronLeftIcon /> <ChevronLeftIcon />
</Box> </Box>
<Box <Box
...@@ -361,7 +360,7 @@ export const SearchBar = () => { ...@@ -361,7 +360,7 @@ export const SearchBar = () => {
value={searchValue} value={searchValue}
/> />
</Row> </Row>
<Box display={{ sm: isOpen ? 'none' : 'flex', lg: 'none' }}> <Box display={{ sm: isOpen ? 'none' : 'flex', xl: 'none' }}>
<NavIcon onClick={toggleOpen}> <NavIcon onClick={toggleOpen}>
<NavMagnifyingGlassIcon width={28} height={28} /> <NavMagnifyingGlassIcon width={28} height={28} />
</NavIcon> </NavIcon>
...@@ -379,6 +378,6 @@ export const SearchBar = () => { ...@@ -379,6 +378,6 @@ export const SearchBar = () => {
))} ))}
</Box> </Box>
{isOpen && <Overlay />} {isOpen && <Overlay />}
</> </Box>
) )
} }
...@@ -11,9 +11,9 @@ export const overlay = style([ ...@@ -11,9 +11,9 @@ export const overlay = style([
position: 'fixed', position: 'fixed',
display: 'block', display: 'block',
background: 'black', background: 'black',
zIndex: '2',
}), }),
{ {
zIndex: 10,
opacity: 0.72, opacity: 0.72,
overflow: 'hidden', overflow: 'hidden',
}, },
......
import { createGlobalTheme } from '@vanilla-extract/css' import { createGlobalTheme, createGlobalThemeContract } from '@vanilla-extract/css'
import { createGlobalThemeContract } from '@vanilla-extract/css'
import { createSprinkles, defineProperties } from '@vanilla-extract/sprinkles' import { createSprinkles, defineProperties } from '@vanilla-extract/sprinkles'
const themeContractValues = { const themeContractValues = {
...@@ -231,7 +230,7 @@ const flexAlignment = [ ...@@ -231,7 +230,7 @@ const flexAlignment = [
const overflow = ['hidden', 'inherit', 'scroll', 'visible', 'auto'] as const const overflow = ['hidden', 'inherit', 'scroll', 'visible', 'auto'] as const
const borderWidth = ['1px', '1.5px', '2px', '4px'] const borderWidth = ['0px', '1px', '1.5px', '2px', '4px']
const borderStyle = ['none', 'solid'] as const const borderStyle = ['none', 'solid'] as const
......
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