Skip to content

Commit 9dc93fe

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

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-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?: React.ReactNode;
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import type { AssetWithFiat, AssetState } from './asset-input.data';
2+
import { Image } from '../profile-picture';
3+
import cardanoImage from '../../assets/images/cardano-blue-bg.png';
4+
5+
import Icon from '../../assets/icons/token.svg';
26

37
export const asset: AssetWithFiat = {
48
balance: String(10_000_000),
59
amount: '',
610
id: '',
711
ticker: 'Token',
12+
icon: <Image imageSrc={cardanoImage} alt="Token" />,
813
fiat: {
914
value: '0',
1015
ticker: 'USD',

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,29 @@ import * as cx from './ticker-button.css';
1010
interface Props {
1111
name: string;
1212
id: string;
13+
icon?: React.ReactNode;
1314
onClick?: () => void;
1415
}
1516

1617
export const TickerButton = ({
1718
name,
1819
id,
20+
icon,
1921
onClick,
2022
}: Readonly<Props>): JSX.Element => (
2123
<button
2224
className={cx.button}
2325
onClick={onClick}
2426
data-testid={`asset-input-ticker-button-${id}`}
2527
>
26-
<Text.SubHeading weight="$bold">
27-
<Flex justifyContent="center" alignItems="center">
28-
{name}
29-
<ChevronRight className={cx.chevronIcon} />
30-
</Flex>
31-
</Text.SubHeading>
28+
<Flex alignItems="center" gap="$16">
29+
{icon}
30+
<Text.SubHeading weight="$bold">
31+
<Flex justifyContent="center" alignItems="center">
32+
<span>{name}</span>
33+
<ChevronRight className={cx.chevronIcon} />
34+
</Flex>
35+
</Text.SubHeading>
36+
</Flex>
3237
</button>
3338
);

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)