Commit ade24406 authored by lynn's avatar lynn Committed by GitHub

fix: missing logo redesign (#4535)

* fix: logos

* different font sizings for diff token sizes from fred

* remove missing symbol

* fix

* fixes to comments

* fix

* use calc instead of fn

* add comment
parent 4dc4620b
...@@ -24,11 +24,13 @@ const StyledNativeLogo = styled(StyledLogo)` ...@@ -24,11 +24,13 @@ const StyledNativeLogo = styled(StyledLogo)`
export default function CurrencyLogo({ export default function CurrencyLogo({
currency, currency,
symbol,
size = '24px', size = '24px',
style, style,
...rest ...rest
}: { }: {
currency?: Currency | null currency?: Currency | null
symbol?: string | null
size?: string size?: string
style?: React.CSSProperties style?: React.CSSProperties
}) { }) {
...@@ -36,6 +38,7 @@ export default function CurrencyLogo({ ...@@ -36,6 +38,7 @@ export default function CurrencyLogo({
alt: `${currency?.symbol ?? 'token'} logo`, alt: `${currency?.symbol ?? 'token'} logo`,
size, size,
srcs: useCurrencyLogoURIs(currency), srcs: useCurrencyLogoURIs(currency),
symbol: symbol ?? currency?.symbol,
style, style,
...rest, ...rest,
} }
......
...@@ -14,13 +14,15 @@ export default function ListLogo({ ...@@ -14,13 +14,15 @@ export default function ListLogo({
style, style,
size = '24px', size = '24px',
alt, alt,
symbol,
}: { }: {
logoURI: string logoURI: string
size?: string size?: string
style?: React.CSSProperties style?: React.CSSProperties
alt?: string alt?: string
symbol?: string
}) { }) {
const srcs: string[] = useHttpLocations(logoURI) const srcs: string[] = useHttpLocations(logoURI)
return <StyledListLogo alt={alt} size={size} srcs={srcs} style={style} /> return <StyledListLogo alt={alt} size={size} symbol={symbol} srcs={srcs} style={style} />
} }
import { useState } from 'react' import { useState } from 'react'
import { Slash } from 'react-feather'
import { ImageProps } from 'rebass' import { ImageProps } from 'rebass'
import { useTheme } from 'styled-components/macro' import styled from 'styled-components/macro'
const BAD_SRCS: { [tokenAddress: string]: true } = {} const BAD_SRCS: { [tokenAddress: string]: true } = {}
interface LogoProps extends Pick<ImageProps, 'style' | 'alt' | 'className'> { interface LogoProps extends Pick<ImageProps, 'style' | 'alt' | 'className'> {
srcs: string[] srcs: string[]
symbol?: string
size?: string
} }
const MissingImageLogo = styled.div<{ size?: string }>`
--size: ${({ size }) => size};
border-radius: 100px;
color: ${({ theme }) => theme.textPrimary};
background-color: ${({ theme }) => theme.backgroundInteractive};
font-size: calc(var(--size) / 3);
font-weight: 500;
height: ${({ size }) => size ?? '24px'};
line-height: ${({ size }) => size ?? '24px'};
text-align: center;
width: ${({ size }) => size ?? '24px'};
`
/** /**
* Renders an image by sequentially trying a list of URIs, and then eventually a fallback triangle alert * Renders an image by sequentially trying a list of URIs, and then eventually a fallback triangle alert
*/ */
export default function Logo({ srcs, alt, style, ...rest }: LogoProps) { export default function Logo({ srcs, alt, style, size, symbol, ...rest }: LogoProps) {
const [, refresh] = useState<number>(0) const [, refresh] = useState<number>(0)
const theme = useTheme()
const src: string | undefined = srcs.find((src) => !BAD_SRCS[src]) const src: string | undefined = srcs.find((src) => !BAD_SRCS[src])
if (src) { if (src) {
...@@ -34,5 +46,10 @@ export default function Logo({ srcs, alt, style, ...rest }: LogoProps) { ...@@ -34,5 +46,10 @@ export default function Logo({ srcs, alt, style, ...rest }: LogoProps) {
) )
} }
return <Slash {...rest} style={{ ...style, color: theme.deprecated_bg4 }} /> return (
<MissingImageLogo size={size}>
{/* use only first 3 characters of Symbol for design reasons */}
{symbol?.toUpperCase().replace('$', '').replace(/\s+/g, '').slice(0, 3)}
</MissingImageLogo>
)
} }
...@@ -165,7 +165,7 @@ function CurrencyRow({ ...@@ -165,7 +165,7 @@ function CurrencyRow({
selected={otherSelected} selected={otherSelected}
> >
<Column> <Column>
<CurrencyLogo currency={currency} size={'24px'} /> <CurrencyLogo currency={currency} size={'36px'} />
</Column> </Column>
<AutoColumn> <AutoColumn>
<Row> <Row>
......
...@@ -231,7 +231,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) { ...@@ -231,7 +231,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) {
<ChartHeader> <ChartHeader>
<TokenInfoContainer> <TokenInfoContainer>
<TokenNameCell> <TokenNameCell>
<CurrencyLogo currency={currency} size={'32px'} /> <CurrencyLogo currency={currency} size={'32px'} symbol={tokenSymbol} />
{tokenName ?? <Trans>Name not found</Trans>} {tokenName ?? <Trans>Name not found</Trans>}
<TokenSymbol>{tokenSymbol ?? <Trans>Symbol not found</Trans>}</TokenSymbol> <TokenSymbol>{tokenSymbol ?? <Trans>Symbol not found</Trans>}</TokenSymbol>
{!warning && <VerifiedIcon size="20px" />} {!warning && <VerifiedIcon size="20px" />}
......
...@@ -505,7 +505,7 @@ export default function LoadedRow({ ...@@ -505,7 +505,7 @@ export default function LoadedRow({
tokenInfo={ tokenInfo={
<ClickableName> <ClickableName>
<LogoContainer> <LogoContainer>
<CurrencyLogo currency={currency} /> <CurrencyLogo currency={currency} symbol={tokenSymbol} />
<L2NetworkLogo networkUrl={L2Icon} /> <L2NetworkLogo networkUrl={L2Icon} />
</LogoContainer> </LogoContainer>
<TokenInfoCell> <TokenInfoCell>
......
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