Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@ import React from 'react';

import { Flex } from '../flex';
import { Text } from '../text';
import { FontWeights } from '../text/create-text.util';

import * as cx from './assets-table-token-amount.css';

import type { TypographyVariants } from '../text/text.css';

interface Props {
amount: string;
fiatPrice: string;
details: string;
detailsColor?: TypographyVariants['color'];
detailsWeight?: FontWeights;
}

export const TokenAmount = ({
amount,
fiatPrice,
details,
detailsColor = 'secondary',
detailsWeight = '$regular',
}: Readonly<Props>): JSX.Element => {
return (
<Flex flexDirection="column" alignItems="flex-end" className={cx.container}>
<Text.Body.Large weight="$semibold" data-testid="token-amount">
{amount}
</Text.Body.Large>
<Text.Body.Normal color="secondary" weight="$semibold">
{fiatPrice}
<Text.Body.Normal color={detailsColor} weight={detailsWeight}>
{details}
</Text.Body.Normal>
</Flex>
);
Expand Down
26 changes: 23 additions & 3 deletions src/design-system/assets-table/assets-table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,22 @@ const SimpleAssetInfo = ({ id }: Readonly<AssetInfoProps>): JSX.Element => (
name="Token name"
description="Subtitle"
/>
<TokenAmount amount="23,584.48" fiatPrice="24,568.54 USD" />
<TokenAmount amount="23,584.48" details="24,568.54 USD" />
</AssetsTable>
);

const PendingAssetInfo = ({ id }: Readonly<AssetInfoProps>): JSX.Element => (
<AssetsTable id={id}>
<TokenProfile
imageSrc={cardanoImage}
name="Token with pending amount"
description="description"
/>
<TokenAmount
amount="21,584.48"
details="+ 5 pending"
detailsColor="success"
/>
</AssetsTable>
);

Expand All @@ -72,7 +87,7 @@ const DetailedAssetInfo = ({
priceChange="+3.21"
priceTrend={priceTrend}
/>
<TokenAmount amount="23,584.48" fiatPrice="24,568.54 USD" />
<TokenAmount amount="23,584.48" details="24,568.54 USD" />
</AssetsTable>
);

Expand Down Expand Up @@ -126,6 +141,11 @@ export const Overview = (): JSX.Element => (
<DetailedAssetInfo />
</Variants.Cell>
</Variants.Row>
<Variants.Row>
<Variants.Cell>
<PendingAssetInfo />
</Variants.Cell>
</Variants.Row>
</Variants.Table>
</Section>

Expand Down Expand Up @@ -188,7 +208,7 @@ export const Controls: Controls = ({
priceChange={priceChange}
priceTrend={priceTrend}
/>
<TokenAmount amount={tokenAmount} fiatPrice={fiatPrice} />
<TokenAmount amount={tokenAmount} details={fiatPrice} />
</AssetsTable>
</Flex>
</Section>
Expand Down
2 changes: 1 addition & 1 deletion src/design-system/password-box/password-box.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React from 'react';

import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
Expand Down