Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide token name Top Tokens #827

Merged
merged 4 commits into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/components/Stats/TokenListItem/TokenListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const TokenListItem: React.FC<IProps> = ({
// const isNegative = priceChange < 0

const isMd = useMediaQuery(theme.breakpoints.down('md'))
const isXs = useMediaQuery(theme.breakpoints.down('xs'))
const isSm = useMediaQuery(theme.breakpoints.down('sm'))

const networkUrl = useMemo(() => {
switch (network) {
Expand Down Expand Up @@ -79,6 +81,7 @@ const TokenListItem: React.FC<IProps> = ({
copyAddressHandler('Failed to copy token address to Clipboard', 'error')
})
}
const shouldShowText = icon === icons.unknownToken || !isSm

return (
<Grid>
Expand All @@ -99,7 +102,15 @@ const TokenListItem: React.FC<IProps> = ({
}}></img>
{isUnknown && <img className={classes.warningIcon} src={icons.warningIcon} />}
</Box>
<Typography>
{shouldShowText && (
<Typography>
{isXs ? shortenAddress(symbol) : name}
{!isXs && (
<span className={classes.tokenSymbol}>{` (${shortenAddress(symbol)})`}</span>
)}
</Typography>
)}
{/* <Typography>
{!isMd ? (
<>
<span className={classes.tokenName}>{name}</span>
Expand All @@ -108,7 +119,7 @@ const TokenListItem: React.FC<IProps> = ({
) : (
shortenAddress(symbol)
)}
</Typography>
</Typography> */}
<TooltipHover text='Copy token address'>
<FileCopyOutlinedIcon
onClick={copyToClipboard}
Expand All @@ -118,7 +129,7 @@ const TokenListItem: React.FC<IProps> = ({
</Grid>
<Typography>{`~$${formatNumber(price)}`}</Typography>

{/* {!hideName && (
{/* {!isXs && (
<Typography style={{ color: isNegative ? colors.invariant.Error : colors.green.main }}>
{isNegative ? `${priceChange.toFixed(2)}%` : `+${priceChange.toFixed(2)}%`}
</Typography>
Expand Down Expand Up @@ -185,7 +196,7 @@ const TokenListItem: React.FC<IProps> = ({
<ArrowDropDownIcon className={classes.icon} />
) : null}
</Typography>
{/* {!hideName && (
{/* {!isXs && (
<Typography
style={{ cursor: 'pointer' }}
onClick={() => {
Expand Down
Loading