Skip to content

Commit aeb6a0a

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

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@ import React from 'react';
22

33
import { Flex } from '../flex';
44
import { Text } from '../text';
5+
import { FontWeights } from '../text/create-text.util';
56

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

9+
import type { TypographyVariants } from '../text/text.css';
10+
811
interface Props {
912
amount: string;
10-
fiatPrice: string;
13+
details: string;
14+
detailsColor?: TypographyVariants['color'];
15+
detailsWeight?: FontWeights;
1116
}
1217

1318
export const TokenAmount = ({
1419
amount,
15-
fiatPrice,
20+
details,
21+
detailsColor = 'secondary',
22+
detailsWeight = '$regular',
1623
}: Readonly<Props>): JSX.Element => {
1724
return (
1825
<Flex flexDirection="column" alignItems="flex-end" className={cx.container}>
1926
<Text.Body.Large weight="$semibold" data-testid="token-amount">
2027
{amount}
2128
</Text.Body.Large>
22-
<Text.Body.Normal color="secondary" weight="$semibold">
23-
{fiatPrice}
29+
<Text.Body.Normal color={detailsColor} weight={detailsWeight}>
30+
{details}
2431
</Text.Body.Normal>
2532
</Flex>
2633
);

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>

src/design-system/password-box/password-box.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22

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

0 commit comments

Comments
 (0)