Commit 8502f9e3 authored by aballerr's avatar aballerr Committed by GitHub

fix: Wallet updates (#4498)

* Wallet Polishing
Co-authored-by: default avatarAlex Ball <alexball@UNISWAP-MAC-038.local>
parent bc90d416
...@@ -70,7 +70,7 @@ const Navbar = () => { ...@@ -70,7 +70,7 @@ const Navbar = () => {
const { pathname } = useLocation() const { pathname } = useLocation()
const nftFlag = useNftFlag() const nftFlag = useNftFlag()
if (windowWidth && windowWidth < breakpoints.xl) { if (windowWidth && windowWidth <= breakpoints.xl) {
return <MobileNavbar /> return <MobileNavbar />
} }
......
...@@ -35,18 +35,23 @@ const ToggleMenuItem = styled.button` ...@@ -35,18 +35,23 @@ const ToggleMenuItem = styled.button`
cursor: pointer; cursor: pointer;
display: flex; display: flex;
flex: 1; flex: 1;
border-radius: 12px;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
width: 100%; width: 100%;
padding: 12px 16px; padding: 12px 8px;
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
:hover { :hover {
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
background-color: ${({ theme }) => theme.backgroundModule}; background-color: ${({ theme }) => theme.backgroundModule};
transition: 250ms all ease; transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms all ${timing.in}`};
} }
` `
...@@ -73,6 +78,7 @@ const IconWrap = styled.span` ...@@ -73,6 +78,7 @@ const IconWrap = styled.span`
const DefaultMenuWrap = styled.div` const DefaultMenuWrap = styled.div`
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 0 8px;
` `
const DefaultText = styled.span` const DefaultText = styled.span`
......
...@@ -24,7 +24,11 @@ const IconStyles = css` ...@@ -24,7 +24,11 @@ const IconStyles = css`
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
:hover { :hover {
background-color: ${({ theme }) => theme.hoverState}; background-color: ${({ theme }) => theme.hoverState};
transition: 250ms background-color ease; transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms background-color ${timing.in}`};
${IconHoverText} { ${IconHoverText} {
opacity: 1; opacity: 1;
......
...@@ -18,26 +18,25 @@ const InternalMenuItem = styled(Link)` ...@@ -18,26 +18,25 @@ const InternalMenuItem = styled(Link)`
} }
` `
const InternalLinkMenuItem = styled(InternalMenuItem)<{ isActive: boolean }>` const InternalLinkMenuItem = styled(InternalMenuItem)`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
padding: 12px 16px; padding: 12px 16px;
justify-content: space-between; justify-content: space-between;
text-decoration: none; text-decoration: none;
background-color: ${({ isActive, theme }) => isActive && theme.accentActionSoft};
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
:hover { :hover {
cursor: pointer; cursor: pointer;
background-color: ${({ isActive, theme }) => !isActive && theme.backgroundModule}; background-color: ${({ theme }) => theme.backgroundModule};
transition: 250ms background-color ease; transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms background-color ${timing.in}`};
} }
` `
const LanguageWrap = styled.div`
margin-top: 16px;
`
function LanguageMenuItem({ locale, isActive }: { locale: SupportedLocale; isActive: boolean }) { function LanguageMenuItem({ locale, isActive }: { locale: SupportedLocale; isActive: boolean }) {
const { to, onClick } = useLocationLinkProps(locale) const { to, onClick } = useLocationLinkProps(locale)
const theme = useTheme() const theme = useTheme()
...@@ -45,11 +44,11 @@ function LanguageMenuItem({ locale, isActive }: { locale: SupportedLocale; isAct ...@@ -45,11 +44,11 @@ function LanguageMenuItem({ locale, isActive }: { locale: SupportedLocale; isAct
if (!to) return null if (!to) return null
return ( return (
<InternalLinkMenuItem isActive={isActive} onClick={onClick} to={to}> <InternalLinkMenuItem onClick={onClick} to={to}>
<Text fontSize={16} fontWeight={400} lineHeight="24px"> <Text fontSize={16} fontWeight={400} lineHeight="24px">
{LOCALE_LABEL[locale]} {LOCALE_LABEL[locale]}
</Text> </Text>
{isActive && <Check color={theme.accentAction} opacity={1} size={20} />} {isActive && <Check color={theme.accentActive} opacity={1} size={20} />}
</InternalLinkMenuItem> </InternalLinkMenuItem>
) )
} }
...@@ -59,11 +58,9 @@ const LanguageMenu = ({ onClose }: { onClose: () => void }) => { ...@@ -59,11 +58,9 @@ const LanguageMenu = ({ onClose }: { onClose: () => void }) => {
return ( return (
<SlideOutMenu title={<Trans>Language</Trans>} onClose={onClose}> <SlideOutMenu title={<Trans>Language</Trans>} onClose={onClose}>
<LanguageWrap>
{SUPPORTED_LOCALES.map((locale) => ( {SUPPORTED_LOCALES.map((locale) => (
<LanguageMenuItem locale={locale} isActive={activeLocale === locale} key={locale} /> <LanguageMenuItem locale={locale} isActive={activeLocale === locale} key={locale} />
))} ))}
</LanguageWrap>
</SlideOutMenu> </SlideOutMenu>
) )
} }
......
...@@ -5,7 +5,24 @@ const Menu = styled.div` ...@@ -5,7 +5,24 @@ const Menu = styled.div`
width: 100%; width: 100%;
height: 100%; height: 100%;
font-size: 16px; font-size: 16px;
overflow-y: scroll; overflow: auto;
// Firefox scrollbar styling
scrollbar-width: thin;
scrollbar-color: ${({ theme }) => `${theme.backgroundOutline} transparent`};
// safari and chrome scrollbar styling
::-webkit-scrollbar {
background: transparent;
width: 4px;
}
::-webkit-scrollbar-track {
margin-top: 40px;
}
::-webkit-scrollbar-thumb {
background: ${({ theme }) => theme.backgroundOutline};
border-radius: 8px;
}
` `
const Header = styled.span` const Header = styled.span`
...@@ -26,7 +43,11 @@ const ClearAll = styled.div` ...@@ -26,7 +43,11 @@ const ClearAll = styled.div`
:hover { :hover {
opacity: 0.6; opacity: 0.6;
transition: 250ms opacity ease; transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms opacity ${timing.in}`};
} }
` `
...@@ -35,7 +56,11 @@ const StyledChevron = styled(ChevronLeft)` ...@@ -35,7 +56,11 @@ const StyledChevron = styled(ChevronLeft)`
&:hover { &:hover {
color: ${({ theme }) => theme.textPrimary}; color: ${({ theme }) => theme.textPrimary};
transition: 250ms color ease; transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms color ${timing.in}`};
} }
` `
......
...@@ -17,6 +17,8 @@ const WalletWrapper = styled.div` ...@@ -17,6 +17,8 @@ const WalletWrapper = styled.div`
top: 60px; top: 60px;
right: 70px; right: 70px;
background-color: ${({ theme }) => theme.backgroundSurface}; background-color: ${({ theme }) => theme.backgroundSurface};
border: ${({ theme }) => `1px solid ${theme.backgroundOutline}`};
box-shadow: ${({ theme }) => theme.deepShadow};
padding: 16px 0; padding: 16px 0;
` `
......
...@@ -9,7 +9,7 @@ import { NavBarVariant, useNavBarFlag } from 'featureFlags/flags/navBar' ...@@ -9,7 +9,7 @@ import { NavBarVariant, useNavBarFlag } from 'featureFlags/flags/navBar'
import { getIsValidSwapQuote } from 'pages/Swap' import { getIsValidSwapQuote } from 'pages/Swap'
import { darken } from 'polished' import { darken } from 'polished'
import { useMemo, useRef } from 'react' import { useMemo, useRef } from 'react'
import { AlertTriangle } from 'react-feather' import { AlertTriangle, ChevronDown, ChevronUp } from 'react-feather'
import { useAppSelector } from 'state/hooks' import { useAppSelector } from 'state/hooks'
import { useDerivedSwapInfo } from 'state/swap/hooks' import { useDerivedSwapInfo } from 'state/swap/hooks'
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
...@@ -54,10 +54,26 @@ const Web3StatusError = styled(Web3StatusGeneric)` ...@@ -54,10 +54,26 @@ const Web3StatusError = styled(Web3StatusGeneric)`
} }
` `
const Web3StatusConnectNavbar = styled.button<{ faded?: boolean }>`
dispay: flex;
align-items: center;
${({ theme }) => theme.flexRowNoWrap}
background-color: ${({ theme }) => theme.accentActionSoft};
border-radius: 12px;
border: none;
cursor: pointer;
padding: 10px 12px;
:hover,
:active,
:focus {
border: none;
}
`
const Web3StatusConnect = styled(Web3StatusGeneric)<{ faded?: boolean }>` const Web3StatusConnect = styled(Web3StatusGeneric)<{ faded?: boolean }>`
background-color: ${({ theme }) => theme.deprecated_primary4}; background-color: ${({ theme }) => theme.deprecated_primary4};
border: none; border: none;
color: ${({ theme }) => theme.deprecated_primaryText1}; color: ${({ theme }) => theme.deprecated_primaryText1};
font-weight: 500; font-weight: 500;
...@@ -130,6 +146,43 @@ function Sock() { ...@@ -130,6 +146,43 @@ function Sock() {
) )
} }
const VerticalDivider = styled.div`
height: 20px;
width: 1px;
background-color: ${({ theme }) => theme.accentAction};
`
const StyledConnect = styled.div`
color: ${({ theme }) => theme.accentAction};
font-weight: 600;
font-size: 16px;
margin-right: 8px;
&:hover {
color: ${({ theme }) => theme.accentActionSoft};
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms color ${timing.in}`};
}
`
const StyledChevron = styled.span`
color: ${({ theme }) => theme.accentAction};
height: 24px;
margin-left: 4px;
&:hover {
color: ${({ theme }) => theme.accentActionSoft};
transition: ${({
theme: {
transition: { duration, timing },
},
}) => `${duration.fast}ms color ${timing.in}`};
}
`
function Web3StatusInner() { function Web3StatusInner() {
const { account, connector, chainId, ENSName } = useWeb3React() const { account, connector, chainId, ENSName } = useWeb3React()
const connectionType = getConnection(connector).type const connectionType = getConnection(connector).type
...@@ -141,6 +194,7 @@ function Web3StatusInner() { ...@@ -141,6 +194,7 @@ function Web3StatusInner() {
const navbarFlag = useNavBarFlag() const navbarFlag = useNavBarFlag()
const toggleWalletDropdown = useToggleWalletDropdown() const toggleWalletDropdown = useToggleWalletDropdown()
const toggleWalletModal = useToggleWalletModal() const toggleWalletModal = useToggleWalletModal()
const walletIsOpen = useIsOpen()
const error = useAppSelector((state) => state.connection.errorByConnectionType[getConnection(connector).type]) const error = useAppSelector((state) => state.connection.errorByConnectionType[getConnection(connector).type])
...@@ -195,11 +249,23 @@ function Web3StatusInner() { ...@@ -195,11 +249,23 @@ function Web3StatusInner() {
properties={{ received_swap_quote: validSwapQuote }} properties={{ received_swap_quote: validSwapQuote }}
element={ElementName.CONNECT_WALLET_BUTTON} element={ElementName.CONNECT_WALLET_BUTTON}
> >
{navbarFlag === NavBarVariant.Enabled ? (
<Web3StatusConnectNavbar faded={!account}>
<StyledConnect onClick={toggleWalletModal}>
<Trans>Connect</Trans>
</StyledConnect>
<VerticalDivider />
<StyledChevron onClick={toggleWalletDropdown}>
{walletIsOpen ? <ChevronUp /> : <ChevronDown />}
</StyledChevron>
</Web3StatusConnectNavbar>
) : (
<Web3StatusConnect onClick={toggleWallet} faded={!account}> <Web3StatusConnect onClick={toggleWallet} faded={!account}>
<Text> <Text>
<Trans>Connect Wallet</Trans> <Trans>Connect Wallet</Trans>
</Text> </Text>
</Web3StatusConnect> </Web3StatusConnect>
)}
</TraceEvent> </TraceEvent>
) )
} }
......
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