Commit 2338255a authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

fix(token-details): nits from design re: headers, spacing, layout (#4829)

* fix(token-details): nits from design re: headers, spacing, layout

* pr feedback
parent 843afa93
...@@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro' ...@@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro'
import { darken } from 'polished' import { darken } from 'polished'
import { useState } from 'react' import { useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ThemedText } from 'theme'
import { textFadeIn } from 'theme/animations' import { textFadeIn } from 'theme/animations'
import Resource from './Resource' import Resource from './Resource'
...@@ -24,8 +25,8 @@ const TokenDescriptionContainer = styled.div` ...@@ -24,8 +25,8 @@ const TokenDescriptionContainer = styled.div`
const TruncateDescriptionButton = styled.div` const TruncateDescriptionButton = styled.div`
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 0.85em;
padding-top: 14px; padding-top: 0.5em;
&:hover, &:hover,
&:focus { &:focus {
...@@ -52,9 +53,8 @@ export const AboutContainer = styled.div` ...@@ -52,9 +53,8 @@ export const AboutContainer = styled.div`
padding: 24px 0px; padding: 24px 0px;
${textFadeIn} ${textFadeIn}
` `
export const AboutHeader = styled.span` export const AboutHeader = styled(ThemedText.MediumHeader)`
font-size: 28px; font-size: 28px !important;
line-height: 36px;
` `
export const ResourcesContainer = styled.div` export const ResourcesContainer = styled.div`
...@@ -90,10 +90,14 @@ export function AboutSection({ address, description, homepageUrl, twitterName }: ...@@ -90,10 +90,14 @@ export function AboutSection({ address, description, homepageUrl, twitterName }:
{tokenDescription} {tokenDescription}
{shouldTruncate && ( {shouldTruncate && (
<TruncateDescriptionButton onClick={() => setIsDescriptionTruncated(!isDescriptionTruncated)}> <TruncateDescriptionButton onClick={() => setIsDescriptionTruncated(!isDescriptionTruncated)}>
{isDescriptionTruncated ? <Trans>Read more</Trans> : <Trans>Hide</Trans>} {isDescriptionTruncated ? <Trans>Show more</Trans> : <Trans>Hide</Trans>}
</TruncateDescriptionButton> </TruncateDescriptionButton>
)} )}
</TokenDescriptionContainer> </TokenDescriptionContainer>
<br />
<ThemedText.SubHeaderSmall>
<Trans>Links</Trans>
</ThemedText.SubHeaderSmall>
<ResourcesContainer> <ResourcesContainer>
<Resource name={'Etherscan'} link={`https://etherscan.io/address/${address}`} /> <Resource name={'Etherscan'} link={`https://etherscan.io/address/${address}`} />
<Resource name={'Protocol info'} link={`https://info.uniswap.org/#/tokens/${address}`} /> <Resource name={'Protocol info'} link={`https://info.uniswap.org/#/tokens/${address}`} />
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { CopyContractAddress } from 'theme' import { CopyContractAddress, ThemedText } from 'theme'
export const ContractAddressSection = styled.div` export const ContractAddressSection = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
color: ${({ theme }) => theme.textSecondary}; color: ${({ theme }) => theme.textSecondary};
font-weight: 600; font-size: 0.9em;
font-size: 14px;
gap: 4px; gap: 4px;
padding: 36px 0px; padding: 4px 0px;
` `
const ContractAddress = styled.button` const ContractAddress = styled.button`
...@@ -26,7 +25,9 @@ const ContractAddress = styled.button` ...@@ -26,7 +25,9 @@ const ContractAddress = styled.button`
export default function AddressSection({ address }: { address: string }) { export default function AddressSection({ address }: { address: string }) {
return ( return (
<ContractAddressSection> <ContractAddressSection>
<Trans>Contract address</Trans> <ThemedText.SubHeaderSmall>
<Trans>Contract address</Trans>
</ThemedText.SubHeaderSmall>
<ContractAddress> <ContractAddress>
<CopyContractAddress address={address} /> <CopyContractAddress address={address} />
</ContractAddress> </ContractAddress>
......
...@@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro' ...@@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro'
import { TokenSortMethod } from 'graphql/data/TopTokens' import { TokenSortMethod } from 'graphql/data/TopTokens'
import { ReactNode } from 'react' import { ReactNode } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ThemedText } from 'theme'
import { textFadeIn } from 'theme/animations' import { textFadeIn } from 'theme/animations'
import { formatDollarAmount } from 'utils/formatDollarAmt' import { formatDollarAmount } from 'utils/formatDollarAmt'
...@@ -21,13 +22,16 @@ export const StatWrapper = styled.div` ...@@ -21,13 +22,16 @@ export const StatWrapper = styled.div`
export const TokenStatsSection = styled.div` export const TokenStatsSection = styled.div`
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
${textFadeIn}
` `
export const StatPair = styled.div` export const StatPair = styled.div`
display: flex; display: flex;
flex: 1; flex: 1;
flex-wrap: wrap; flex-wrap: wrap;
` `
const Header = styled(ThemedText.MediumHeader)`
font-size: 28px !important;
`
const StatTitle = styled.div` const StatTitle = styled.div`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
...@@ -40,6 +44,10 @@ const StatPrice = styled.span` ...@@ -40,6 +44,10 @@ const StatPrice = styled.span`
const NoData = styled.div` const NoData = styled.div`
color: ${({ theme }) => theme.textTertiary}; color: ${({ theme }) => theme.textTertiary};
` `
const Wrapper = styled.div`
gap: 16px;
${textFadeIn}
`
type NumericStat = number | undefined | null type NumericStat = number | undefined | null
...@@ -66,28 +74,33 @@ export default function StatsSection(props: StatsSectionProps) { ...@@ -66,28 +74,33 @@ export default function StatsSection(props: StatsSectionProps) {
const { priceLow52W, priceHigh52W, TVL, volume24H } = props const { priceLow52W, priceHigh52W, TVL, volume24H } = props
if (TVL || volume24H || priceLow52W || priceHigh52W) { if (TVL || volume24H || priceLow52W || priceHigh52W) {
return ( return (
<TokenStatsSection> <Wrapper>
<StatPair> <Header>
<Stat <Trans>Stats</Trans>
value={TVL} </Header>
description={HEADER_DESCRIPTIONS[TokenSortMethod.TOTAL_VALUE_LOCKED]} <TokenStatsSection>
title={<Trans>TVL</Trans>} <StatPair>
/> <Stat
<Stat value={TVL}
value={volume24H} description={HEADER_DESCRIPTIONS[TokenSortMethod.TOTAL_VALUE_LOCKED]}
description={ title={<Trans>TVL</Trans>}
<Trans> />
24H volume is the amount of the asset that has been traded on Uniswap v3 during the past 24 hours. <Stat
</Trans> value={volume24H}
} description={
title={<Trans>24H volume</Trans>} <Trans>
/> 24H volume is the amount of the asset that has been traded on Uniswap v3 during the past 24 hours.
</StatPair> </Trans>
<StatPair> }
<Stat value={priceLow52W} title={<Trans>52W low</Trans>} /> title={<Trans>24H volume</Trans>}
<Stat value={priceHigh52W} title={<Trans>52W high</Trans>} /> />
</StatPair> </StatPair>
</TokenStatsSection> <StatPair>
<Stat value={priceLow52W} title={<Trans>52W low</Trans>} />
<Stat value={priceHigh52W} title={<Trans>52W high</Trans>} />
</StatPair>
</TokenStatsSection>
</Wrapper>
) )
} else { } else {
return <NoData>No stats available</NoData> return <NoData>No stats available</NoData>
......
...@@ -31,6 +31,12 @@ import { ArrowLeft } from 'react-feather' ...@@ -31,6 +31,12 @@ import { ArrowLeft } from 'react-feather'
import { useNavigate, useParams } from 'react-router-dom' import { useNavigate, useParams } from 'react-router-dom'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
const Hr = styled.hr`
background-color: ${({ theme }) => theme.textSecondary};
opacity: 24%;
border: none;
height: 0.5px;
`
export const TokenDetailsLayout = styled.div` export const TokenDetailsLayout = styled.div`
display: flex; display: flex;
gap: 60px; gap: 60px;
...@@ -177,6 +183,7 @@ export default function TokenDetails() { ...@@ -177,6 +183,7 @@ export default function TokenDetails() {
priceHigh52W={tokenQueryData.market?.priceHigh52W?.value} priceHigh52W={tokenQueryData.market?.priceHigh52W?.value}
priceLow52W={tokenQueryData.market?.priceLow52W?.value} priceLow52W={tokenQueryData.market?.priceLow52W?.value}
/> />
<Hr />
<AboutSection <AboutSection
address={tokenQueryData.address ?? ''} address={tokenQueryData.address ?? ''}
description={tokenQueryData.project?.description} description={tokenQueryData.project?.description}
......
...@@ -355,6 +355,9 @@ export const ThemedText = { ...@@ -355,6 +355,9 @@ export const ThemedText = {
SubHeader(props: TextProps) { SubHeader(props: TextProps) {
return <TextWrapper fontWeight={600} fontSize={16} color={'textPrimary'} {...props} /> return <TextWrapper fontWeight={600} fontSize={16} color={'textPrimary'} {...props} />
}, },
SubHeaderSmall(props: TextProps) {
return <TextWrapper fontWeight={500} fontSize={14} color={'textSecondary'} {...props} />
},
DeprecatedSmall(props: TextProps) { DeprecatedSmall(props: TextProps) {
return <TextWrapper fontWeight={500} fontSize={11} {...props} /> return <TextWrapper fontWeight={500} fontSize={11} {...props} />
}, },
......
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