Skip to content

Commit

Permalink
fix: token details info text selection (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSinclair authored Jul 29, 2024
1 parent f82dfd7 commit 70cbe02
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
19 changes: 12 additions & 7 deletions src/design-system/components/TextOverflow/TextOverflow.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import clsx from 'clsx';
import React, { CSSProperties } from 'react';

import { TextStyles, textStyles } from '../../styles/core.css';
import { Box } from '../Box/Box';
import { Inset } from '../Inset/Inset';
import { selectionStyle } from '../Text/Text.css';

interface TextOverflowProps {
align?: TextStyles['textAlign'];
Expand Down Expand Up @@ -37,12 +39,10 @@ export function TextOverflow({
marginVertical="-8px"
className={textStyles({
color,
cursor,
fontFamily: 'rounded',
fontSize: size,
fontWeight: weight,
textAlign: align,
userSelect,
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
Expand All @@ -53,11 +53,16 @@ export function TextOverflow({
<Inset vertical="8px">
<Box
as={as}
style={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
className={clsx([
textStyles({
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
userSelect,
cursor,
}),
selectionStyle,
])}
>
{children}
</Box>
Expand Down
10 changes: 8 additions & 2 deletions src/entries/popup/pages/home/TokenDetails/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const InfoRow = ({
size="12pt"
weight="semibold"
cursor="text"
userSelect="all"
userSelect="text"
>
{value}
</TextOverflow>
Expand Down Expand Up @@ -208,7 +208,13 @@ function Description({ text = '' }: { text?: string | null }) {
if (!text) return null;
const chunks = chunkLinks(text);
return (
<Text color="labelTertiary" size="14pt" weight="regular">
<Text
color="labelTertiary"
size="14pt"
weight="regular"
cursor="text"
userSelect="text"
>
{chunks.map((chunk, i) => {
if (chunk.type === 'text') {
return chunk.value;
Expand Down
22 changes: 14 additions & 8 deletions src/entries/popup/pages/home/TokenDetails/PriceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ const PriceChange = memo(function PriceChange({
const { color, symbol } = parsePriceChange(+changePercentage.toFixed(2));
return (
<Box display="flex" flexDirection="column" gap="10px" alignItems="flex-end">
<Text size="16pt" weight="heavy" color={color}>
<Inline alignVertical="center" space="4px">
{symbol && (
<Symbol color={color} size={12} symbol={symbol} weight="heavy" />
)}{' '}
<Inline alignVertical="center" space="4px">
{symbol && (
<Symbol color={color} size={12} symbol={symbol} weight="heavy" />
)}
<Text
size="16pt"
weight="heavy"
color={color}
cursor="text"
userSelect="text"
>
{Math.abs(changePercentage).toFixed(2)} %
</Inline>
</Text>
</Text>
</Inline>
<Text size="14pt" weight="heavy" color={color}>
{formatDate(date)}
</Text>
Expand Down Expand Up @@ -84,7 +90,7 @@ const TokenPrice = memo(function TokenPrice({
justifyContent="center"
gap="10px"
>
<Text size="16pt" weight="heavy" cursor="text" userSelect="all">
<Text size="16pt" weight="heavy" cursor="text" userSelect="text">
{!isLoading && !hasPriceData && !fallbackPrice
? i18n.t('token_details.not_available')
: formatCurrency(
Expand Down
4 changes: 2 additions & 2 deletions src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function BalanceValue({
weight="semibold"
color={color}
cursor="text"
userSelect="all"
userSelect="text"
>
{hideAssetBalances ? <HiddenValue /> : balance.value}{' '}
{balance.symbol}
Expand All @@ -160,7 +160,7 @@ function BalanceValue({
color={color}
align="right"
cursor="text"
userSelect="all"
userSelect="text"
>
{getPrice(nativeBalance, chainId)}
</TextOverflow>
Expand Down

0 comments on commit 70cbe02

Please sign in to comment.