Skip to content

Commit ab88f90

Browse files
committed
feat: make token amount details configurable [LW-11733]
1 parent 7c89f4d commit ab88f90

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/design-system/assets-table/assets-table-token-amount.component.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ import { Text } from '../text';
55

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

8+
import type { TypographyVariants } from '../text/text.css';
9+
810
interface Props {
911
amount: string;
10-
fiatPrice: string;
12+
details: string;
13+
detailsColor?: TypographyVariants['color'];
1114
}
1215

1316
export const TokenAmount = ({
1417
amount,
15-
fiatPrice,
18+
details,
19+
detailsColor = 'secondary',
1620
}: Readonly<Props>): JSX.Element => {
1721
return (
1822
<Flex flexDirection="column" alignItems="flex-end" className={cx.container}>
1923
<Text.Body.Large weight="$semibold" data-testid="token-amount">
2024
{amount}
2125
</Text.Body.Large>
22-
<Text.Body.Normal color="secondary" weight="$semibold">
23-
{fiatPrice}
26+
<Text.Body.Normal color={detailsColor} weight="$regular">
27+
{details}
2428
</Text.Body.Normal>
2529
</Flex>
2630
);

src/design-system/assets-table/assets-table.stories.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,22 @@ const SimpleAssetInfo = ({ id }: Readonly<AssetInfoProps>): JSX.Element => (
5353
name="Token name"
5454
description="Subtitle"
5555
/>
56-
<TokenAmount amount="23,584.48" fiatPrice="24,568.54 USD" />
56+
<TokenAmount amount="23,584.48" details="24,568.54 USD" />
57+
</AssetsTable>
58+
);
59+
60+
const PendingAssetInfo = ({ id }: Readonly<AssetInfoProps>): JSX.Element => (
61+
<AssetsTable id={id}>
62+
<TokenProfile
63+
imageSrc={cardanoImage}
64+
name="Token with pending amount"
65+
description="description"
66+
/>
67+
<TokenAmount
68+
amount="21,584.48"
69+
details="+ 5 pending"
70+
detailsColor="success"
71+
/>
5772
</AssetsTable>
5873
);
5974

@@ -72,7 +87,7 @@ const DetailedAssetInfo = ({
7287
priceChange="+3.21"
7388
priceTrend={priceTrend}
7489
/>
75-
<TokenAmount amount="23,584.48" fiatPrice="24,568.54 USD" />
90+
<TokenAmount amount="23,584.48" details="24,568.54 USD" />
7691
</AssetsTable>
7792
);
7893

@@ -126,6 +141,11 @@ export const Overview = (): JSX.Element => (
126141
<DetailedAssetInfo />
127142
</Variants.Cell>
128143
</Variants.Row>
144+
<Variants.Row>
145+
<Variants.Cell>
146+
<PendingAssetInfo />
147+
</Variants.Cell>
148+
</Variants.Row>
129149
</Variants.Table>
130150
</Section>
131151

@@ -188,7 +208,7 @@ export const Controls: Controls = ({
188208
priceChange={priceChange}
189209
priceTrend={priceTrend}
190210
/>
191-
<TokenAmount amount={tokenAmount} fiatPrice={fiatPrice} />
211+
<TokenAmount amount={tokenAmount} details={fiatPrice} />
192212
</AssetsTable>
193213
</Flex>
194214
</Section>

0 commit comments

Comments
 (0)