Skip to content

Commit b189594

Browse files
committed
feat: [lw-12577] make fiat optional in assett input, add badge into asset table
1 parent 2a30be3 commit b189594

File tree

9 files changed

+39
-11
lines changed

9 files changed

+39
-11
lines changed

src/design-system/asset-input/asset-input.component.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ export const AssetInput = ({
3636
</Box>
3737
<Box className={cx.amountBox}>
3838
<Flex alignItems="center" justifyContent="flex-end">
39-
<MaxButton
39+
{!!onMaxClick && <MaxButton
4040
label="MAX"
4141
data-testid={`asset-input-max-button-${state.asset.id}`}
4242
onClick={(): void => {
4343
onMaxClick?.(state.asset);
4444
}}
45-
/>
45+
/>}
4646
<Box ml="$8">
4747
<AmountInput
4848
id={state.asset.id}
@@ -65,9 +65,9 @@ export const AssetInput = ({
6565
alignItems="flex-end"
6666
justifyContent="flex-end"
6767
>
68-
<Text.Body.Normal color="secondary">
68+
{!!state.asset.fiat && <Text.Body.Normal color="secondary">
6969
{state.asset.fiat.value} {state.asset.fiat.ticker}
70-
</Text.Body.Normal>
70+
</Text.Body.Normal>}
7171
{state.type === 'invalid' && (
7272
<Text.Label
7373
color="error"

src/design-system/asset-input/asset-input.data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface Asset {
66
}
77

88
export interface AssetWithFiat extends Asset {
9-
fiat: {
9+
fiat?: {
1010
value: string;
1111
ticker: string;
1212
};

src/design-system/asset-input/ticker-button.component.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import ChevronRight from '@icons/ChevronRightComponent';
55
import { Text } from '../text';
66

77
import * as cx from './ticker-button.css';
8+
import { Flex } from '../flex';
89

910
interface Props {
1011
name: string;
@@ -23,8 +24,10 @@ export const TickerButton = ({
2324
data-testid={`asset-input-ticker-button-${id}`}
2425
>
2526
<Text.SubHeading weight="$bold">
26-
{name}
27-
<ChevronRight className={cx.chevronIcon} />
27+
<Flex justifyContent="center" alignItems="center">
28+
{name}
29+
<ChevronRight className={cx.chevronIcon} />
30+
</Flex>
2831
</Text.SubHeading>
2932
</button>
3033
);

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Flex } from '../flex';
12
import React, { ReactElement, ReactNode } from 'react';
23

34
import { Box } from '../box';
@@ -16,6 +17,7 @@ type TokenProfileProps = {
1617
alt?: string;
1718
image: ReactNode;
1819
name: ReactNode;
20+
badge?: string;
1921
description: ReactNode;
2022
testId?: string;
2123
};
@@ -24,6 +26,7 @@ export const TokenProfile = ({
2426
alt,
2527
image,
2628
name,
29+
badge,
2730
description,
2831
testId = 'token-profile',
2932
}: Readonly<TokenProfileProps>): ReactElement => {
@@ -45,9 +48,14 @@ export const TokenProfile = ({
4548
<Box mr="$24">{imageNode}</Box>
4649
</Cell>
4750
<Cell>
48-
<Text.Body.Large weight="$semibold" data-testid={`${testId}-name`}>
49-
{name}
50-
</Text.Body.Large>
51+
<Flex alignItems="center" gap="$8">
52+
<Text.Body.Large weight="$semibold" data-testid={`${testId}-name`}>
53+
{name}
54+
</Text.Body.Large>
55+
{!!badge && <Text.Label className={cx.badge} weight="$medium" data-testid={`${testId}-badge`}>
56+
{badge}
57+
</Text.Label>}
58+
</Flex>
5159
<Box>
5260
<Text.Body.Normal
5361
color="secondary"
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
import { style } from '../../design-tokens';
1+
import { style, vars } from '../../design-tokens';
22

33
export const container = style({
44
gridArea: 'tokenProfile',
55
});
6+
7+
export const badge = style({
8+
backgroundColor: vars.colors.$assets_table_badge_bgColor,
9+
borderRadius: vars.radius.$medium,
10+
padding: `0 ${vars.spacing.$4}`,
11+
color: vars.colors.$assets_table_badge_textColor,
12+
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export const Controls: Controls = ({
203203
image={cardanoImage}
204204
name={tokenName}
205205
description={tokenSubtitle}
206+
badge="Badge"
206207
/>
207208
<MarketPrice
208209
tokenPrice={tokenPrice}

src/design-tokens/colors.data.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ export const colors = {
109109

110110
$assets_table_container_bgColor_hover: '',
111111

112+
$assets_table_badge_bgColor: '',
113+
$assets_table_badge_textColor: '',
114+
112115
$dialog_container_bgColor: '',
113116
$dialog_description_color: '',
114117

src/design-tokens/theme/dark-theme.css.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ const colors: Colors = {
167167

168168
$assets_table_container_bgColor_hover: darkColorScheme.$primary_mid_grey,
169169

170+
$assets_table_badge_bgColor: '#0000FE',
171+
$assets_table_badge_textColor: lightColorScheme.$primary_white,
172+
170173
$dialog_container_bgColor: darkColorScheme.$primary_light_black,
171174
$dialog_description_color: darkColorScheme.$primary_light_grey,
172175

src/design-tokens/theme/light-theme.css.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ const colors: Colors = {
180180

181181
$assets_table_container_bgColor_hover: lightColorScheme.$primary_light_grey,
182182

183+
$assets_table_badge_bgColor: '#0000FE',
184+
$assets_table_badge_textColor: lightColorScheme.$primary_white,
185+
183186
$dialog_container_bgColor: lightColorScheme.$primary_white,
184187
$dialog_description_color: lightColorScheme.$primary_black,
185188

0 commit comments

Comments
 (0)