Skip to content

Commit b4aacf6

Browse files
committed
feat: [lw-12215] add asset icon into asset input
1 parent c4e0577 commit b4aacf6

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const AssetInput = ({
2828
<Box className={cx.assetNameBox}>
2929
<TickerButton
3030
id={state.asset.id}
31+
icon={state.asset.icon}
3132
name={state.asset.ticker}
3233
onClick={(): void => {
3334
onTickerClick?.(state.asset);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import React from 'react';
2+
13
export interface Asset {
24
id: string;
35
ticker: string;
46
balance: string;
57
amount: string;
8+
icon?: string;
69
}
710

811
export interface AssetWithFiat extends Asset {

src/design-system/asset-input/asset-input.fixtures.ts renamed to src/design-system/asset-input/asset-input.fixtures.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { AssetWithFiat, AssetState } from './asset-input.data';
2+
import cardanoImage from '../../assets/images/cardano-blue-bg.png';
23

34
export const asset: AssetWithFiat = {
45
balance: String(10_000_000),
56
amount: '',
67
id: '',
78
ticker: 'Token',
9+
icon: cardanoImage,
810
fiat: {
911
value: '0',
1012
ticker: 'USD',
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22

33
import ChevronRight from '@icons/ChevronRightComponent';
4+
import { Image } from '../profile-picture';
45

56
import { Flex } from '../flex';
67
import { Text } from '../text';
@@ -10,24 +11,29 @@ import * as cx from './ticker-button.css';
1011
interface Props {
1112
name: string;
1213
id: string;
14+
icon?: string;
1315
onClick?: () => void;
1416
}
1517

1618
export const TickerButton = ({
1719
name,
1820
id,
21+
icon,
1922
onClick,
2023
}: Readonly<Props>): JSX.Element => (
2124
<button
2225
className={cx.button}
2326
onClick={onClick}
2427
data-testid={`asset-input-ticker-button-${id}`}
2528
>
26-
<Text.SubHeading weight="$bold">
27-
<Flex justifyContent="center" alignItems="center">
28-
{name}
29-
<ChevronRight className={cx.chevronIcon} />
30-
</Flex>
31-
</Text.SubHeading>
29+
<Flex alignItems="center" gap="$16">
30+
{icon && <Image imageSrc={icon} alt="Token" />}
31+
<Text.SubHeading weight="$bold">
32+
<Flex justifyContent="center" alignItems="center">
33+
<span>{name}</span>
34+
<ChevronRight className={cx.chevronIcon} />
35+
</Flex>
36+
</Text.SubHeading>
37+
</Flex>
3238
</button>
3339
);

src/design-system/asset-input/ticker-button.css.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const button = style({
99
});
1010

1111
export const chevronIcon = sx({
12-
w: '$16',
13-
h: '$16',
12+
w: '$auto',
13+
h: '$auto',
1414
marginLeft: '$8',
1515
});

0 commit comments

Comments
 (0)