Commit ba9c2889 authored by aballerr's avatar aballerr Committed by GitHub

fix: Fixing token modal warning to match figma design (#4476)

* fixing token modal warning to match figma design
Co-authored-by: default avatarAlex Ball <alexball@UNISWAP-MAC-038.local>
parent 49c31ddf
...@@ -4,14 +4,13 @@ import { ButtonPrimary } from 'components/Button' ...@@ -4,14 +4,13 @@ import { ButtonPrimary } from 'components/Button'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import CurrencyLogo from 'components/CurrencyLogo' import CurrencyLogo from 'components/CurrencyLogo'
import TokenSafetyLabel from 'components/TokenSafety/TokenSafetyLabel' import TokenSafetyLabel from 'components/TokenSafety/TokenSafetyLabel'
import { checkWarning, getWarningCopy, TOKEN_SAFETY_ARTICLE, Warning, WARNING_LEVEL } from 'constants/tokenSafety' import { checkWarning, getWarningCopy, TOKEN_SAFETY_ARTICLE, Warning } from 'constants/tokenSafety'
import { useToken } from 'hooks/Tokens' import { useToken } from 'hooks/Tokens'
import { ExternalLink as LinkIconFeather } from 'react-feather' import { ExternalLink as LinkIconFeather } from 'react-feather'
import { Text } from 'rebass' import { Text } from 'rebass'
import { useAddUserToken } from 'state/user/hooks' import { useAddUserToken } from 'state/user/hooks'
import styled, { useTheme } from 'styled-components/macro' import styled from 'styled-components/macro'
import { ButtonText, CopyLinkIcon, ExternalLink } from 'theme' import { ButtonText, CopyLinkIcon, ExternalLink } from 'theme'
import { Color } from 'theme/styled'
import { ExplorerDataType, getExplorerLink } from 'utils/getExplorerLink' import { ExplorerDataType, getExplorerLink } from 'utils/getExplorerLink'
const Wrapper = styled.div` const Wrapper = styled.div`
...@@ -46,19 +45,28 @@ const InfoText = styled(Text)` ...@@ -46,19 +45,28 @@ const InfoText = styled(Text)`
text-align: center; text-align: center;
` `
const StyledButton = styled(ButtonPrimary)<{ buttonColor: Color; textColor: Color }>` const StyledButton = styled(ButtonPrimary)`
color: ${({ textColor }) => textColor};
background-color: ${({ buttonColor }) => buttonColor};
margin-top: 24px; margin-top: 24px;
width: 100%; width: 100%;
:hover { font-weight: 600;
background-color: ${({ buttonColor, theme }) => buttonColor ?? theme.accentAction}; `
const StyledCloseButton = styled(StyledButton)`
background-color: ${({ theme }) => theme.backgroundInteractive};
color: ${({ theme }) => theme.textPrimary};
&:hover {
background-color: ${({ theme }) => theme.backgroundInteractive};
opacity: 0.6;
transition: opacity 250ms ease;
} }
` `
const StyledCancelButton = styled(ButtonText)<{ color?: Color }>` const StyledCancelButton = styled(ButtonText)`
margin-top: 16px; margin-top: 16px;
color: ${({ color, theme }) => color ?? theme.accentAction}; color: ${({ theme }) => theme.textSecondary};
font-weight: 600;
font-size: 14px;
` `
const Buttons = ({ const Buttons = ({
...@@ -70,37 +78,17 @@ const Buttons = ({ ...@@ -70,37 +78,17 @@ const Buttons = ({
onContinue: () => void onContinue: () => void
onCancel: () => void onCancel: () => void
}) => { }) => {
const theme = useTheme()
let textColor, buttonColor, cancelColor
switch (warning.level) {
case WARNING_LEVEL.MEDIUM:
textColor = theme.white
buttonColor = theme.accentAction
cancelColor = theme.accentAction
break
case WARNING_LEVEL.UNKNOWN:
textColor = theme.accentFailure
buttonColor = theme.accentFailureSoft
cancelColor = theme.textPrimary
break
case WARNING_LEVEL.BLOCKED:
textColor = theme.textPrimary
buttonColor = theme.backgroundInteractive
break
}
return warning.canProceed ? ( return warning.canProceed ? (
<> <>
<StyledButton buttonColor={buttonColor} textColor={textColor} onClick={onContinue}> <StyledButton onClick={onContinue}>
<Trans>I understand</Trans> <Trans>I understand</Trans>
</StyledButton> </StyledButton>
<StyledCancelButton color={cancelColor} onClick={onCancel}> <StyledCancelButton onClick={onCancel}>Cancel</StyledCancelButton>
Cancel
</StyledCancelButton>
</> </>
) : ( ) : (
<StyledButton buttonColor={buttonColor} textColor={textColor} onClick={onCancel}> <StyledCloseButton onClick={onCancel}>
<Trans>Close</Trans> <Trans>Close</Trans>
</StyledButton> </StyledCloseButton>
) )
} }
...@@ -124,8 +112,8 @@ const ExplorerContainer = styled.div` ...@@ -124,8 +112,8 @@ const ExplorerContainer = styled.div`
height: 32px; height: 32px;
margin-top: 10px; margin-top: 10px;
font-size: 20px; font-size: 20px;
background-color: ${({ theme }) => theme.accentActiveSoft}; background-color: ${({ theme }) => theme.accentActionSoft};
color: ${({ theme }) => theme.accentActive}; color: ${({ theme }) => theme.accentAction};
border-radius: 8px; border-radius: 8px;
padding: 2px 12px; padding: 2px 12px;
display: flex; display: flex;
...@@ -190,6 +178,10 @@ function ExplorerView({ token }: { token: Token }) { ...@@ -190,6 +178,10 @@ function ExplorerView({ token }: { token: Token }) {
} }
} }
const StyledExternalLink = styled(ExternalLink)`
font-weight: 600;
`
interface TokenSafetyProps { interface TokenSafetyProps {
tokenAddress: string | null tokenAddress: string | null
secondTokenAddress?: string secondTokenAddress?: string
...@@ -254,9 +246,9 @@ export default function TokenSafety({ tokenAddress, secondTokenAddress, onContin ...@@ -254,9 +246,9 @@ export default function TokenSafety({ tokenAddress, secondTokenAddress, onContin
<ShortColumn> <ShortColumn>
<InfoText> <InfoText>
{description}{' '} {description}{' '}
<ExternalLink href={TOKEN_SAFETY_ARTICLE}> <StyledExternalLink href={TOKEN_SAFETY_ARTICLE}>
<Trans>Learn more</Trans> <Trans>Learn more</Trans>
</ExternalLink> </StyledExternalLink>
</InfoText> </InfoText>
</ShortColumn> </ShortColumn>
<LinkColumn>{urls}</LinkColumn> <LinkColumn>{urls}</LinkColumn>
......
...@@ -131,7 +131,7 @@ const CopyIcon = styled(Copy)` ...@@ -131,7 +131,7 @@ const CopyIcon = styled(Copy)`
${IconStyle} ${IconStyle}
${ClickableStyle} ${ClickableStyle}
${LinkStyle} ${LinkStyle}
stroke: ${({ theme }) => theme.accentActive}; stroke: ${({ theme }) => theme.accentAction};
` `
export const TrashIcon = styled(Trash)` export const TrashIcon = styled(Trash)`
......
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