Commit 11aa641d authored by lynn's avatar lynn Committed by GitHub

feat: wallet connect redesign (#4381)

* init

* pending and failed states

* simplify

* fixes in respond to fred nits

* update overlay
parent 2f329059
...@@ -50,9 +50,12 @@ export const BaseButton = styled(RebassButton)< ...@@ -50,9 +50,12 @@ export const BaseButton = styled(RebassButton)<
} }
` `
export const ButtonPrimary = styled(BaseButton)` export const ButtonPrimary = styled(BaseButton)<{ redesignFlag?: boolean }>`
background-color: ${({ theme }) => theme.deprecated_primary1}; background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.accentAction : theme.deprecated_primary1)};
color: white; font-size: ${({ redesignFlag }) => redesignFlag && '20px'};
font-weight: ${({ redesignFlag }) => redesignFlag && '600'};
padding: ${({ redesignFlag }) => redesignFlag && '16px'};
color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.accentTextLightPrimary : 'white')};
&:focus { &:focus {
box-shadow: 0 0 0 1pt ${({ theme }) => darken(0.05, theme.deprecated_primary1)}; box-shadow: 0 0 0 1pt ${({ theme }) => darken(0.05, theme.deprecated_primary1)};
background-color: ${({ theme }) => darken(0.05, theme.deprecated_primary1)}; background-color: ${({ theme }) => darken(0.05, theme.deprecated_primary1)};
......
...@@ -9,12 +9,13 @@ const rotate = keyframes` ...@@ -9,12 +9,13 @@ const rotate = keyframes`
} }
` `
const StyledSVG = styled.svg<{ size: string; stroke?: string }>` const StyledSVG = styled.svg<{ size: string; stroke?: string; redesignFlag?: boolean }>`
animation: 2s ${rotate} linear infinite; animation: 2s ${rotate} linear infinite;
height: ${({ size }) => size}; height: ${({ size }) => size};
width: ${({ size }) => size}; width: ${({ size }) => size};
path { path {
stroke: ${({ stroke, theme }) => stroke ?? theme.deprecated_primary1}; stroke: ${({ stroke, redesignFlag, theme }) =>
redesignFlag ? theme.accentActive : stroke ?? theme.deprecated_primary1};
} }
` `
...@@ -25,17 +26,29 @@ const StyledSVG = styled.svg<{ size: string; stroke?: string }>` ...@@ -25,17 +26,29 @@ const StyledSVG = styled.svg<{ size: string; stroke?: string }>`
export default function Loader({ export default function Loader({
size = '16px', size = '16px',
stroke, stroke,
strokeWidth,
redesignFlag,
...rest ...rest
}: { }: {
size?: string size?: string
stroke?: string stroke?: string
strokeWidth?: number
redesignFlag?: boolean
[k: string]: any [k: string]: any
}) { }) {
return ( return (
<StyledSVG viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" size={size} stroke={stroke} {...rest}> <StyledSVG
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
size={size}
stroke={stroke}
redesignFlag={redesignFlag}
{...rest}
>
<path <path
d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 9.27455 20.9097 6.80375 19.1414 5" d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 9.27455 20.9097 6.80375 19.1414 5"
strokeWidth="2.5" strokeWidth={strokeWidth ?? '2.5'}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
/> />
......
...@@ -9,7 +9,7 @@ import { isMobile } from '../../utils/userAgent' ...@@ -9,7 +9,7 @@ import { isMobile } from '../../utils/userAgent'
const AnimatedDialogOverlay = animated(DialogOverlay) const AnimatedDialogOverlay = animated(DialogOverlay)
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const StyledDialogOverlay = styled(AnimatedDialogOverlay)` const StyledDialogOverlay = styled(AnimatedDialogOverlay)<{ redesignFlag?: boolean }>`
&[data-reach-dialog-overlay] { &[data-reach-dialog-overlay] {
z-index: 2; z-index: 2;
background-color: transparent; background-color: transparent;
...@@ -19,7 +19,7 @@ const StyledDialogOverlay = styled(AnimatedDialogOverlay)` ...@@ -19,7 +19,7 @@ const StyledDialogOverlay = styled(AnimatedDialogOverlay)`
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: ${({ theme }) => theme.deprecated_modalBG}; background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundScrim : theme.deprecated_modalBG)};
} }
` `
...@@ -84,6 +84,7 @@ interface ModalProps { ...@@ -84,6 +84,7 @@ interface ModalProps {
maxHeight?: number maxHeight?: number
initialFocusRef?: React.RefObject<any> initialFocusRef?: React.RefObject<any>
children?: React.ReactNode children?: React.ReactNode
redesignFlag?: boolean
} }
export default function Modal({ export default function Modal({
...@@ -93,6 +94,7 @@ export default function Modal({ ...@@ -93,6 +94,7 @@ export default function Modal({
maxHeight = 90, maxHeight = 90,
initialFocusRef, initialFocusRef,
children, children,
redesignFlag,
}: ModalProps) { }: ModalProps) {
const fadeTransition = useTransition(isOpen, null, { const fadeTransition = useTransition(isOpen, null, {
config: { duration: 200 }, config: { duration: 200 },
...@@ -124,6 +126,7 @@ export default function Modal({ ...@@ -124,6 +126,7 @@ export default function Modal({
onDismiss={onDismiss} onDismiss={onDismiss}
initialFocusRef={initialFocusRef} initialFocusRef={initialFocusRef}
unstable_lockFocusAcrossFrames={false} unstable_lockFocusAcrossFrames={false}
redesignFlag={redesignFlag}
> >
<StyledDialogContent <StyledDialogContent
{...(isMobile {...(isMobile
......
import { ElementName, Event, EventName } from 'components/AmplitudeAnalytics/constants' import { ElementName, Event, EventName } from 'components/AmplitudeAnalytics/constants'
import { TraceEvent } from 'components/AmplitudeAnalytics/TraceEvent' import { TraceEvent } from 'components/AmplitudeAnalytics/TraceEvent'
import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign'
import React from 'react' import React from 'react'
import { Check } from 'react-feather'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ExternalLink } from '../../theme' import { ExternalLink } from '../../theme'
const InfoCard = styled.button<{ isActive?: boolean }>` const InfoCard = styled.button<{ isActive?: boolean; redesignFlag?: boolean }>`
background-color: ${({ theme, isActive }) => (isActive ? theme.deprecated_bg3 : theme.deprecated_bg2)}; background-color: ${({ theme, isActive, redesignFlag }) =>
redesignFlag ? theme.backgroundInteractive : isActive ? theme.deprecated_bg3 : theme.deprecated_bg2};
padding: 1rem; padding: 1rem;
outline: none; outline: none;
border: 1px solid; border: 1px solid;
border-radius: 12px; border-radius: 12px;
width: 100% !important; width: 100% !important;
&:focus { &:focus {
box-shadow: 0 0 0 1px ${({ theme }) => theme.deprecated_primary1}; box-shadow: ${({ theme, redesignFlag }) => !redesignFlag && `0 0 0 1px ${theme.deprecated_primary1}`};
background-color: ${({ theme, redesignFlag }) => redesignFlag && theme.hoverState};
} }
border-color: ${({ theme, isActive }) => (isActive ? 'transparent' : theme.deprecated_bg3)}; border-color: ${({ theme, isActive, redesignFlag }) =>
redesignFlag ? (isActive ? theme.accentActive : 'transparent') : isActive ? 'transparent' : theme.deprecated_bg3};
`
const CheckIcon = styled(Check)`
${({ theme }) => theme.flexColumnNoWrap};
height: 20px;
width: 20px;
align-items: center;
justify-content: center;
color: ${({ theme }) => theme.accentAction};
${({ theme }) => theme.mediaWidth.upToMedium`
align-items: flex-end;
`};
` `
const OptionCard = styled(InfoCard as any)` const OptionCard = styled(InfoCard as any)`
...@@ -33,11 +50,18 @@ const OptionCardLeft = styled.div` ...@@ -33,11 +50,18 @@ const OptionCardLeft = styled.div`
height: 100%; height: 100%;
` `
const OptionCardClickable = styled(OptionCard as any)<{ clickable?: boolean }>` const OptionCardClickable = styled(OptionCard as any)<{
active?: boolean
clickable?: boolean
redesignFlag?: boolean
}>`
margin-top: 0; margin-top: 0;
border: ${({ active, theme }) => active && `1px solid ${theme.accentActive}`};
&:hover { &:hover {
cursor: ${({ clickable }) => (clickable ? 'pointer' : '')}; cursor: ${({ clickable }) => clickable && 'pointer'};
border: ${({ clickable, theme }) => (clickable ? `1px solid ${theme.deprecated_primary1}` : ``)}; background-color: ${({ theme, redesignFlag }) => redesignFlag && theme.hoverState};
border: ${({ clickable, redesignFlag, theme }) =>
clickable && !redesignFlag && `1px solid ${theme.deprecated_primary1}`};
} }
opacity: ${({ disabled }) => (disabled ? '0.5' : '1')}; opacity: ${({ disabled }) => (disabled ? '0.5' : '1')};
` `
...@@ -63,12 +87,14 @@ const CircleWrapper = styled.div` ...@@ -63,12 +87,14 @@ const CircleWrapper = styled.div`
align-items: center; align-items: center;
` `
const HeaderText = styled.div` const HeaderText = styled.div<{ redesignFlag?: boolean }>`
${({ theme }) => theme.flexRowNoWrap}; ${({ theme }) => theme.flexRowNoWrap};
align-items: center;
justify-content: center;
color: ${(props) => color: ${(props) =>
props.color === 'blue' ? ({ theme }) => theme.deprecated_primary1 : ({ theme }) => theme.deprecated_text1}; props.color === 'blue' ? ({ theme }) => theme.deprecated_primary1 : ({ theme }) => theme.deprecated_text1};
font-size: 1rem; font-size: ${({ redesignFlag }) => (redesignFlag ? '16px' : '1rem')};
font-weight: 500; font-weight: ${({ redesignFlag }) => (redesignFlag ? '600' : '500')};
` `
const SubHeader = styled.div` const SubHeader = styled.div`
...@@ -77,7 +103,7 @@ const SubHeader = styled.div` ...@@ -77,7 +103,7 @@ const SubHeader = styled.div`
font-size: 12px; font-size: 12px;
` `
const IconWrapper = styled.div<{ size?: number | null }>` const IconWrapperDeprecated = styled.div<{ size?: number | null }>`
${({ theme }) => theme.flexColumnNoWrap}; ${({ theme }) => theme.flexColumnNoWrap};
align-items: center; align-items: center;
justify-content: center; justify-content: center;
...@@ -91,6 +117,21 @@ const IconWrapper = styled.div<{ size?: number | null }>` ...@@ -91,6 +117,21 @@ const IconWrapper = styled.div<{ size?: number | null }>`
`}; `};
` `
const IconWrapper = styled.div<{ size?: number | null }>`
${({ theme }) => theme.flexColumnNoWrap};
align-items: center;
justify-content: center;
padding-right: 12px;
& > img,
span {
height: ${({ size }) => (size ? size + 'px' : '28px')};
width: ${({ size }) => (size ? size + 'px' : '28px')};
}
${({ theme }) => theme.mediaWidth.upToMedium`
align-items: flex-end;
`};
`
export default function Option({ export default function Option({
link = null, link = null,
clickable = true, clickable = true,
...@@ -114,6 +155,9 @@ export default function Option({ ...@@ -114,6 +155,9 @@ export default function Option({
isActive?: boolean isActive?: boolean
id: string id: string
}) { }) {
const redesignFlag = useRedesignFlag()
const redesignFlagEnabled = redesignFlag === RedesignVariant.Enabled
const content = ( const content = (
<TraceEvent <TraceEvent
events={[Event.onClick]} events={[Event.onClick]}
...@@ -121,32 +165,53 @@ export default function Option({ ...@@ -121,32 +165,53 @@ export default function Option({
properties={{ wallet_type: header }} properties={{ wallet_type: header }}
element={ElementName.WALLET_TYPE_OPTION} element={ElementName.WALLET_TYPE_OPTION}
> >
<OptionCardClickable {redesignFlagEnabled ? (
id={id} <OptionCardClickable
onClick={onClick} id={id}
clickable={clickable && !isActive} onClick={onClick}
active={isActive} clickable={clickable && !isActive}
data-testid="wallet-modal-option" active={isActive}
> redesignFlag={true}
<OptionCardLeft> data-testid="wallet-modal-option"
<HeaderText color={color}> >
{isActive ? ( <OptionCardLeft>
<CircleWrapper> <HeaderText color={color} redesignFlag={true}>
<GreenCircle> <IconWrapper size={size}>
<div /> <img src={icon} alt={'Icon'} />
</GreenCircle> </IconWrapper>
</CircleWrapper> {header}
) : ( </HeaderText>
'' {subheader && <SubHeader>{subheader}</SubHeader>}
)} </OptionCardLeft>
{header} {isActive && <CheckIcon />}
</HeaderText> </OptionCardClickable>
{subheader && <SubHeader>{subheader}</SubHeader>} ) : (
</OptionCardLeft> <OptionCardClickable
<IconWrapper size={size}> id={id}
<img src={icon} alt={'Icon'} /> onClick={onClick}
</IconWrapper> clickable={clickable && !isActive}
</OptionCardClickable> active={isActive}
redesignFlag={false}
data-testid="wallet-modal-option"
>
<OptionCardLeft>
<HeaderText color={color} redesignFlag={false}>
{isActive && (
<CircleWrapper>
<GreenCircle>
<div />
</GreenCircle>
</CircleWrapper>
)}
{header}
</HeaderText>
{subheader && <SubHeader>{subheader}</SubHeader>}
</OptionCardLeft>
<IconWrapperDeprecated size={size}>
<img src={icon} alt={'Icon'} />
</IconWrapperDeprecated>
</OptionCardClickable>
)}
</TraceEvent> </TraceEvent>
) )
if (link) { if (link) {
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Connector } from '@web3-react/types' import { Connector } from '@web3-react/types'
import { ButtonEmpty, ButtonPrimary } from 'components/Button' import { ButtonEmpty, ButtonPrimary } from 'components/Button'
import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign'
import { AlertTriangle } from 'react-feather'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ThemedText } from 'theme' import { ThemedText } from 'theme'
...@@ -16,6 +18,21 @@ const PendingSection = styled.div` ...@@ -16,6 +18,21 @@ const PendingSection = styled.div`
} }
` `
const WaitingToConnectSection = styled.div`
justify-content: center;
align-items: center;
display: flex;
flex-direction: column;
`
const AlertTriangleIcon = styled(AlertTriangle)`
width: 25%;
height: 25%;
stroke-width: 1;
padding-bottom: 2rem;
color: ${({ theme }) => theme.accentCritical};
`
const LoaderContainer = styled.div` const LoaderContainer = styled.div`
margin: 16px 0; margin: 16px 0;
${({ theme }) => theme.flexRowNoWrap}; ${({ theme }) => theme.flexRowNoWrap};
...@@ -57,7 +74,58 @@ export default function PendingView({ ...@@ -57,7 +74,58 @@ export default function PendingView({
tryActivation: (connector: Connector) => void tryActivation: (connector: Connector) => void
openOptions: () => void openOptions: () => void
}) { }) {
return ( const redesignFlag = useRedesignFlag()
const redesignFlagEnabled = redesignFlag === RedesignVariant.Enabled
return redesignFlagEnabled ? (
<PendingSection>
<LoadingMessage>
<LoadingWrapper>
{error ? (
<ErrorGroup>
<AlertTriangleIcon />
<ThemedText.MediumHeader marginBottom={12}>
<Trans>Error connecting</Trans>
</ThemedText.MediumHeader>
<ThemedText.BodyPrimary fontSize={16} marginBottom={36} textAlign="center">
<Trans>
The connection attempt failed. Please click try again and follow the steps to connect in your wallet.
</Trans>
</ThemedText.BodyPrimary>
<ButtonPrimary
$borderRadius="12px"
redesignFlag={true}
onClick={() => {
tryActivation(connector)
}}
>
<Trans>Try Again</Trans>
</ButtonPrimary>
<ButtonEmpty width="fit-content" padding="0" marginTop={20}>
<ThemedText.Link onClick={openOptions}>
<Trans>Back to wallet selection</Trans>
</ThemedText.Link>
</ButtonEmpty>
</ErrorGroup>
) : (
<>
<WaitingToConnectSection>
<LoaderContainer style={{ padding: '16px 0px' }}>
<Loader redesignFlag={true} strokeWidth={0.8} size="100px" />
</LoaderContainer>
<ThemedText.MediumHeader>
<Trans>Waiting to connect</Trans>
</ThemedText.MediumHeader>
<ThemedText.SubHeader style={{ paddingTop: '8px' }}>
<Trans>Confirm this connection in your wallet</Trans>
</ThemedText.SubHeader>
</WaitingToConnectSection>
</>
)}
</LoadingWrapper>
</LoadingMessage>
</PendingSection>
) : (
<PendingSection> <PendingSection>
<LoadingMessage> <LoadingMessage>
<LoadingWrapper> <LoadingWrapper>
......
...@@ -15,6 +15,7 @@ import { AutoColumn } from 'components/Column' ...@@ -15,6 +15,7 @@ import { AutoColumn } from 'components/Column'
import { AutoRow } from 'components/Row' import { AutoRow } from 'components/Row'
import { ConnectionType } from 'connection' import { ConnectionType } from 'connection'
import { getConnection, getConnectionName, getIsCoinbaseWallet, getIsInjected, getIsMetaMask } from 'connection/utils' import { getConnection, getConnectionName, getIsCoinbaseWallet, getIsInjected, getIsMetaMask } from 'connection/utils'
import { RedesignVariant, useRedesignFlag } from 'featureFlags/flags/redesign'
import { useStablecoinValue } from 'hooks/useStablecoinPrice' import { useStablecoinValue } from 'hooks/useStablecoinPrice'
import { useCurrencyBalances } from 'lib/hooks/useCurrencyBalance' import { useCurrencyBalances } from 'lib/hooks/useCurrencyBalance'
import useNativeCurrency from 'lib/hooks/useNativeCurrency' import useNativeCurrency from 'lib/hooks/useNativeCurrency'
...@@ -59,25 +60,30 @@ const CloseColor = styled(Close)` ...@@ -59,25 +60,30 @@ const CloseColor = styled(Close)`
} }
` `
const Wrapper = styled.div` const Wrapper = styled.div<{ redesignFlag?: boolean }>`
${({ theme }) => theme.flexColumnNoWrap} ${({ theme }) => theme.flexColumnNoWrap}
background-color: ${({ redesignFlag, theme }) => redesignFlag && theme.backgroundSurface};
outline: ${({ theme, redesignFlag }) => redesignFlag && `1px solid ${theme.backgroundOutline}`};
box-shadow: ${({ redesignFlag, theme }) => redesignFlag && theme.deepShadow};
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 100%; width: 100%;
` `
const HeaderRow = styled.div` const HeaderRow = styled.div<{ redesignFlag?: boolean }>`
${({ theme }) => theme.flexRowNoWrap}; ${({ theme }) => theme.flexRowNoWrap};
padding: 1rem 1rem; padding: 1rem 1rem;
font-weight: 500; font-weight: ${({ redesignFlag }) => (redesignFlag ? '600' : '500')};
size: ${({ redesignFlag }) => redesignFlag && '16px'};
color: ${(props) => (props.color === 'blue' ? ({ theme }) => theme.deprecated_primary1 : 'inherit')}; color: ${(props) => (props.color === 'blue' ? ({ theme }) => theme.deprecated_primary1 : 'inherit')};
${({ theme }) => theme.mediaWidth.upToMedium` ${({ theme }) => theme.mediaWidth.upToMedium`
padding: 1rem; padding: 1rem;
`}; `};
` `
const ContentWrapper = styled.div` const ContentWrapper = styled.div<{ redesignFlag?: boolean }>`
background-color: ${({ theme }) => theme.deprecated_bg0}; background-color: ${({ theme, redesignFlag }) => (redesignFlag ? theme.backgroundSurface : theme.deprecated_bg0)};
border: ${({ theme, redesignFlag }) => redesignFlag && `1px solid ${theme.backgroundOutline}`};
padding: 0 1rem 1rem 1rem; padding: 0 1rem 1rem 1rem;
border-bottom-left-radius: 20px; border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px; border-bottom-right-radius: 20px;
...@@ -183,6 +189,8 @@ export default function WalletModal({ ...@@ -183,6 +189,8 @@ export default function WalletModal({
const { connector, account, chainId } = useWeb3React() const { connector, account, chainId } = useWeb3React()
const [connectedWallets, addWalletToConnectedWallets] = useConnectedWallets() const [connectedWallets, addWalletToConnectedWallets] = useConnectedWallets()
const redesignFlag = useRedesignFlag()
const redesignFlagEnabled = redesignFlag === RedesignVariant.Enabled
const [walletView, setWalletView] = useState(WALLET_VIEWS.ACCOUNT) const [walletView, setWalletView] = useState(WALLET_VIEWS.ACCOUNT)
const [lastActiveWalletAddress, setLastActiveWalletAddress] = useState<string | undefined>(account) const [lastActiveWalletAddress, setLastActiveWalletAddress] = useState<string | undefined>(account)
const [shouldLogWalletBalances, setShouldLogWalletBalances] = useState(false) const [shouldLogWalletBalances, setShouldLogWalletBalances] = useState(false)
...@@ -357,9 +365,7 @@ export default function WalletModal({ ...@@ -357,9 +365,7 @@ export default function WalletModal({
} }
let headerRow let headerRow
if (walletView === WALLET_VIEWS.PENDING) { if (walletView === WALLET_VIEWS.PENDING || walletView === WALLET_VIEWS.ACCOUNT || !!account) {
headerRow = null
} else if (walletView === WALLET_VIEWS.ACCOUNT || !!account) {
headerRow = ( headerRow = (
<HeaderRow color="blue"> <HeaderRow color="blue">
<HoverText onClick={() => setWalletView(account ? WALLET_VIEWS.ACCOUNT : WALLET_VIEWS.OPTIONS)}> <HoverText onClick={() => setWalletView(account ? WALLET_VIEWS.ACCOUNT : WALLET_VIEWS.OPTIONS)}>
...@@ -369,7 +375,7 @@ export default function WalletModal({ ...@@ -369,7 +375,7 @@ export default function WalletModal({
) )
} else { } else {
headerRow = ( headerRow = (
<HeaderRow> <HeaderRow redesignFlag={redesignFlagEnabled}>
<HoverText> <HoverText>
<Trans>Connect a wallet</Trans> <Trans>Connect a wallet</Trans>
</HoverText> </HoverText>
...@@ -377,6 +383,39 @@ export default function WalletModal({ ...@@ -377,6 +383,39 @@ export default function WalletModal({
) )
} }
function getTermsOfService(redesignFlagEnabled: boolean) {
return redesignFlagEnabled ? (
<AutoRow style={{ flexWrap: 'nowrap', padding: '4px 16px' }}>
<ThemedText.BodySecondary fontSize={12}>
<Trans>
By connecting a wallet, you agree to Uniswap Labs’{' '}
<ExternalLink href="https://uniswap.org/terms-of-service/">Terms of Service</ExternalLink> and acknowledge
that you have read and understand the Uniswap{' '}
<ExternalLink href="https://uniswap.org/disclaimer/">Protocol Disclaimer</ExternalLink>.
</Trans>
</ThemedText.BodySecondary>
</AutoRow>
) : (
<LightCard>
<AutoRow style={{ flexWrap: 'nowrap' }}>
<ThemedText.DeprecatedBody fontSize={12}>
<Trans>
By connecting a wallet, you agree to Uniswap Labs’{' '}
<ExternalLink style={{ textDecoration: 'underline' }} href="https://uniswap.org/terms-of-service/">
Terms of Service
</ExternalLink>{' '}
and acknowledge that you have read and understand the Uniswap{' '}
<ExternalLink style={{ textDecoration: 'underline' }} href="https://uniswap.org/disclaimer/">
Protocol Disclaimer
</ExternalLink>
.
</Trans>
</ThemedText.DeprecatedBody>
</AutoRow>
</LightCard>
)
}
return ( return (
<UpperSection> <UpperSection>
<CloseIcon onClick={toggleWalletModal}> <CloseIcon onClick={toggleWalletModal}>
...@@ -394,28 +433,7 @@ export default function WalletModal({ ...@@ -394,28 +433,7 @@ export default function WalletModal({
/> />
)} )}
{walletView !== WALLET_VIEWS.PENDING && <OptionGrid data-testid="option-grid">{getOptions()}</OptionGrid>} {walletView !== WALLET_VIEWS.PENDING && <OptionGrid data-testid="option-grid">{getOptions()}</OptionGrid>}
{!pendingError && ( {!pendingError && getTermsOfService(redesignFlagEnabled)}
<LightCard>
<AutoRow style={{ flexWrap: 'nowrap' }}>
<ThemedText.DeprecatedBody fontSize={12}>
<Trans>
By connecting a wallet, you agree to Uniswap Labs’{' '}
<ExternalLink
style={{ textDecoration: 'underline' }}
href="https://uniswap.org/terms-of-service/"
>
Terms of Service
</ExternalLink>{' '}
and acknowledge that you have read and understand the Uniswap{' '}
<ExternalLink style={{ textDecoration: 'underline' }} href="https://uniswap.org/disclaimer/">
Protocol Disclaimer
</ExternalLink>
.
</Trans>
</ThemedText.DeprecatedBody>
</AutoRow>
</LightCard>
)}
</AutoColumn> </AutoColumn>
</ContentWrapper> </ContentWrapper>
</UpperSection> </UpperSection>
...@@ -423,8 +441,14 @@ export default function WalletModal({ ...@@ -423,8 +441,14 @@ export default function WalletModal({
} }
return ( return (
<Modal isOpen={walletModalOpen} onDismiss={toggleWalletModal} minHeight={false} maxHeight={90}> <Modal
<Wrapper>{getModalContent()}</Wrapper> isOpen={walletModalOpen}
onDismiss={toggleWalletModal}
minHeight={false}
maxHeight={90}
redesignFlag={redesignFlagEnabled}
>
<Wrapper redesignFlag={redesignFlagEnabled}>{getModalContent()}</Wrapper>
</Modal> </Modal>
) )
} }
...@@ -188,6 +188,7 @@ export interface Palette { ...@@ -188,6 +188,7 @@ export interface Palette {
accentSuccess: Color accentSuccess: Color
accentWarning: Color accentWarning: Color
accentFailure: Color accentFailure: Color
accentCritical: Color
accentActionSoft: Color accentActionSoft: Color
accentActiveSoft: Color accentActiveSoft: Color
...@@ -222,6 +223,7 @@ export interface Palette { ...@@ -222,6 +223,7 @@ export interface Palette {
chain_42161_background: Color chain_42161_background: Color
flyoutDropShadow: Color flyoutDropShadow: Color
deepShadow: Color
} }
export const colorsLight: Palette = { export const colorsLight: Palette = {
...@@ -244,6 +246,7 @@ export const colorsLight: Palette = { ...@@ -244,6 +246,7 @@ export const colorsLight: Palette = {
accentSuccess: colors.green400, accentSuccess: colors.green400,
accentWarning: colors.gold200, accentWarning: colors.gold200,
accentFailure: colors.red400, accentFailure: colors.red400,
accentCritical: colors.red400,
accentActionSoft: opacify(12, colors.pink400), accentActionSoft: opacify(12, colors.pink400),
accentActiveSoft: opacify(12, colors.blue400), accentActiveSoft: opacify(12, colors.blue400),
...@@ -279,6 +282,8 @@ export const colorsLight: Palette = { ...@@ -279,6 +282,8 @@ export const colorsLight: Palette = {
flyoutDropShadow: flyoutDropShadow:
'0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.12);', '0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.12);',
deepShadow:
'8px 12px 20px rgba(51, 53, 72, 0.04), 4px 6px 12px rgba(51, 53, 72, 0.02), 4px 4px 8px rgba(51, 53, 72, 0.04)',
} }
export const colorsDark: Palette = { export const colorsDark: Palette = {
...@@ -301,6 +306,7 @@ export const colorsDark: Palette = { ...@@ -301,6 +306,7 @@ export const colorsDark: Palette = {
accentSuccess: colors.greenVibrant, accentSuccess: colors.greenVibrant,
accentWarning: colors.gold200, accentWarning: colors.gold200,
accentFailure: colors.red400, accentFailure: colors.red400,
accentCritical: colors.red300,
accentActionSoft: opacify(24, colors.blue400), accentActionSoft: opacify(24, colors.blue400),
accentActiveSoft: opacify(12, colors.blue400), accentActiveSoft: opacify(12, colors.blue400),
...@@ -336,4 +342,5 @@ export const colorsDark: Palette = { ...@@ -336,4 +342,5 @@ export const colorsDark: Palette = {
flyoutDropShadow: flyoutDropShadow:
'0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.12);', '0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.12);',
deepShadow: '12px 16px 24px rgba(0, 0, 0, 0.24), 12px 8px 12px rgba(0, 0, 0, 0.24), 4px 4px 8px rgba(0, 0, 0, 0.32)',
} }
...@@ -13,7 +13,7 @@ import { darkTheme } from '../nft/themes/darkTheme' ...@@ -13,7 +13,7 @@ import { darkTheme } from '../nft/themes/darkTheme'
import { lightTheme } from '../nft/themes/lightTheme' import { lightTheme } from '../nft/themes/lightTheme'
import { useIsDarkMode } from '../state/user/hooks' import { useIsDarkMode } from '../state/user/hooks'
import { colors as ColorsPalette, colorsDark, colorsLight } from './colors' import { colors as ColorsPalette, colorsDark, colorsLight } from './colors'
import { Colors, ThemeColors } from './styled' import { AllColors, Colors, ThemeColors } from './styled'
import { opacify } from './utils' import { opacify } from './utils'
export * from './components' export * from './components'
...@@ -77,6 +77,7 @@ function uniswapThemeColors(darkMode: boolean): ThemeColors { ...@@ -77,6 +77,7 @@ function uniswapThemeColors(darkMode: boolean): ThemeColors {
accentSuccess: darkMode ? colorsDark.accentSuccess : colorsLight.accentSuccess, accentSuccess: darkMode ? colorsDark.accentSuccess : colorsLight.accentSuccess,
accentWarning: darkMode ? colorsDark.accentWarning : colorsLight.accentWarning, accentWarning: darkMode ? colorsDark.accentWarning : colorsLight.accentWarning,
accentFailure: darkMode ? colorsDark.accentFailure : colorsLight.accentFailure, accentFailure: darkMode ? colorsDark.accentFailure : colorsLight.accentFailure,
accentCritical: darkMode ? colorsDark.accentCritical : colorsLight.accentCritical,
accentActionSoft: darkMode ? colorsDark.accentActionSoft : colorsLight.accentActionSoft, accentActionSoft: darkMode ? colorsDark.accentActionSoft : colorsLight.accentActionSoft,
accentActiveSoft: darkMode ? colorsDark.accentActiveSoft : colorsLight.accentActiveSoft, accentActiveSoft: darkMode ? colorsDark.accentActiveSoft : colorsLight.accentActiveSoft,
...@@ -111,6 +112,7 @@ function uniswapThemeColors(darkMode: boolean): ThemeColors { ...@@ -111,6 +112,7 @@ function uniswapThemeColors(darkMode: boolean): ThemeColors {
blue200: ColorsPalette.blue200, blue200: ColorsPalette.blue200,
flyoutDropShadow: flyoutDropShadow:
'0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.12)', '0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.12)',
deepShadow: darkMode ? colorsDark.deepShadow : colorsLight.deepShadow,
hoverState: opacify(24, ColorsPalette.blue200), hoverState: opacify(24, ColorsPalette.blue200),
hoverDefault: opacify(8, ColorsPalette.gray200), hoverDefault: opacify(8, ColorsPalette.gray200),
} }
...@@ -280,7 +282,7 @@ export default function ThemeProvider({ children }: { children: React.ReactNode ...@@ -280,7 +282,7 @@ export default function ThemeProvider({ children }: { children: React.ReactNode
return <StyledComponentsThemeProvider theme={themeObject}>{children}</StyledComponentsThemeProvider> return <StyledComponentsThemeProvider theme={themeObject}>{children}</StyledComponentsThemeProvider>
} }
const TextWrapper = styled(Text)<{ color: keyof Colors }>` const TextWrapper = styled(Text)<{ color: keyof AllColors }>`
color: ${({ color, theme }) => (theme as any)[color]}; color: ${({ color, theme }) => (theme as any)[color]};
` `
...@@ -294,6 +296,9 @@ export const ThemedText = { ...@@ -294,6 +296,9 @@ export const ThemedText = {
DeprecatedLink(props: TextProps) { DeprecatedLink(props: TextProps) {
return <TextWrapper fontWeight={500} color={'deprecated_primary1'} {...props} /> return <TextWrapper fontWeight={500} color={'deprecated_primary1'} {...props} />
}, },
Link(props: TextProps) {
return <TextWrapper fontWeight={600} fontSize={14} color={'accentAction'} {...props} />
},
DeprecatedLabel(props: TextProps) { DeprecatedLabel(props: TextProps) {
return <TextWrapper fontWeight={600} color={'deprecated_text1'} {...props} /> return <TextWrapper fontWeight={600} color={'deprecated_text1'} {...props} />
}, },
...@@ -306,15 +311,27 @@ export const ThemedText = { ...@@ -306,15 +311,27 @@ export const ThemedText = {
DeprecatedBody(props: TextProps) { DeprecatedBody(props: TextProps) {
return <TextWrapper fontWeight={400} fontSize={16} color={'deprecated_text1'} {...props} /> return <TextWrapper fontWeight={400} fontSize={16} color={'deprecated_text1'} {...props} />
}, },
BodySecondary(props: TextProps) {
return <TextWrapper fontWeight={400} fontSize={16} color={'textSecondary'} {...props} />
},
BodyPrimary(props: TextProps) {
return <TextWrapper fontWeight={400} fontSize={16} color={'textPrimary'} {...props} />
},
DeprecatedLargeHeader(props: TextProps) { DeprecatedLargeHeader(props: TextProps) {
return <TextWrapper fontWeight={600} fontSize={24} {...props} /> return <TextWrapper fontWeight={600} fontSize={24} {...props} />
}, },
DeprecatedMediumHeader(props: TextProps) { DeprecatedMediumHeader(props: TextProps) {
return <TextWrapper fontWeight={500} fontSize={20} {...props} /> return <TextWrapper fontWeight={500} fontSize={20} {...props} />
}, },
MediumHeader(props: TextProps) {
return <TextWrapper fontWeight={400} fontSize={20} color={'textPrimary'} {...props} />
},
DeprecatedSubHeader(props: TextProps) { DeprecatedSubHeader(props: TextProps) {
return <TextWrapper fontWeight={400} fontSize={14} {...props} /> return <TextWrapper fontWeight={400} fontSize={14} {...props} />
}, },
SubHeader(props: TextProps) {
return <TextWrapper fontWeight={600} fontSize={16} color={'textPrimary'} {...props} />
},
DeprecatedSmall(props: TextProps) { DeprecatedSmall(props: TextProps) {
return <TextWrapper fontWeight={500} fontSize={11} {...props} /> return <TextWrapper fontWeight={500} fontSize={11} {...props} />
}, },
......
import { FlattenSimpleInterpolation, ThemedCssFunction } from 'styled-components/macro' import { FlattenSimpleInterpolation, ThemedCssFunction } from 'styled-components/macro'
export type Color = string export type Color = string
export type AllColors = ThemeColors | Colors
export interface ThemeColors { export interface ThemeColors {
userThemeColor: string userThemeColor: string
...@@ -20,6 +22,7 @@ export interface ThemeColors { ...@@ -20,6 +22,7 @@ export interface ThemeColors {
accentSuccess: Color accentSuccess: Color
accentWarning: Color accentWarning: Color
accentFailure: Color accentFailure: Color
accentCritical: Color
accentActionSoft: Color accentActionSoft: Color
accentActiveSoft: Color accentActiveSoft: Color
...@@ -52,6 +55,7 @@ export interface ThemeColors { ...@@ -52,6 +55,7 @@ export interface ThemeColors {
blue200: Color blue200: Color
flyoutDropShadow: Color flyoutDropShadow: Color
deepShadow: Color
hoverState: Color hoverState: Color
hoverDefault: Color hoverDefault: Color
} }
......
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