Skip to content

Commit

Permalink
fix(suite): fix typography style of link and blur urls
Browse files Browse the repository at this point in the history
  • Loading branch information
enjojoy committed Dec 2, 2024
1 parent cb8fc3f commit bc45a18
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/suite/src/components/suite/FormattedNftAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SignValue } from '@suite-common/suite-types';
import { isNftMultitokenTransfer } from '@suite-common/wallet-utils';
import { TokenTransfer } from '@trezor/connect';
import { Box, Column, Row, Text } from '@trezor/components';
import { spacings } from '@trezor/theme';
import { spacings, TypographyStyle } from '@trezor/theme';

import { HiddenPlaceholder, Sign, Translation } from 'src/components/suite';
// importing directly, otherwise unit tests fail, seems to be a styled-components issue
Expand All @@ -19,6 +19,7 @@ export interface FormattedNftAmountProps {
className?: string;
isWithLink?: boolean;
alignMultitoken?: 'flex-end' | 'flex-start';
linkTypographyStyle?: TypographyStyle;
}

export const FormattedNftAmount = ({
Expand All @@ -27,15 +28,16 @@ export const FormattedNftAmount = ({
className,
isWithLink,
alignMultitoken = 'flex-end',
linkTypographyStyle,
}: FormattedNftAmountProps) => {
const theme = useTheme();
const { translationString } = useTranslation();
const { selectedAccount } = useSelector(state => state.wallet);
const { network } = selectedAccount;

const symbolComponent = transfer.symbol ? (
<Text maxWidth={120} ellipsisLineCount={1}>
{transfer.symbol}
<Text ellipsisLineCount={1}>
<BlurUrls text={transfer.symbol} />
</Text>
) : null;

Expand Down Expand Up @@ -70,7 +72,7 @@ export const FormattedNftAmount = ({
href={`${network?.explorer.nft}/${transfer.contract}/${token.id}`}
color={theme.textSecondaryHighlight}
variant="underline"
typographyStyle="label"
typographyStyle={linkTypographyStyle}
>
<Text maxWidth={145} ellipsisLineCount={1}>
{token.id}
Expand Down Expand Up @@ -104,7 +106,7 @@ export const FormattedNftAmount = ({
}
color={theme.textSecondaryHighlight}
variant="underline"
typographyStyle="label"
typographyStyle={linkTypographyStyle}
>
<Row gap={spacings.zero}>
<Text maxWidth={145} ellipsisLineCount={1}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export const AmountDetails = ({ tx, isTestnet }: AmountDetailsProps) => {
withLink={true}
withSign={true}
alignMultitoken="flex-start"
linkTypographyStyle="hint"
/>
</Text>
</Table.Cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const EthereumSpecificBalanceDetailsRow = ({
transfer={transfer}
isWithLink
alignMultitoken="flex-start"
linkTypographyStyle="label"
/>
) : (
formatAmount(transfer.amount, transfer.decimals)
Expand Down
4 changes: 4 additions & 0 deletions packages/suite/src/components/wallet/AmountComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { isNftTokenTransfer, formatAmount, getTxOperation } from '@suite-common/wallet-utils';
import { TokenTransfer } from '@trezor/connect';
import { TypographyStyle } from '@trezor/theme';

import { FormattedNftAmount } from 'src/components/suite/FormattedNftAmount';
import { FormattedCryptoAmount } from 'src/components/suite/FormattedCryptoAmount';
Expand All @@ -9,13 +10,15 @@ type AmountComponentProps = {
withLink?: boolean;
withSign?: boolean;
alignMultitoken?: 'flex-end' | 'flex-start';
linkTypographyStyle?: TypographyStyle;
};

export const AmountComponent = ({
transfer,
withLink = false,
withSign = false,
alignMultitoken,
linkTypographyStyle,
}: AmountComponentProps): React.ReactNode => {
const operation = getTxOperation(transfer.type);

Expand All @@ -26,6 +29,7 @@ export const AmountComponent = ({
isWithLink={withLink}
signValue={withSign ? operation : null}
alignMultitoken={alignMultitoken}
linkTypographyStyle={linkTypographyStyle}
/>
);
}
Expand Down

0 comments on commit bc45a18

Please sign in to comment.