Skip to content

Commit 57d0fba

Browse files
authored
Merge pull request #108 from input-output-hk/feat/lw-12215-selected-tocket-icon
feat: [lw-12215] add asset icon into asset input
2 parents c4e0577 + 53c0788 commit 57d0fba

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface Asset {
33
ticker: string;
44
balance: string;
55
amount: string;
6+
icon?: string;
67
}
78

89
export interface AssetWithFiat extends Asset {

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

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

35
export const asset: AssetWithFiat = {
46
balance: String(10_000_000),
57
amount: '',
68
id: '',
79
ticker: 'Token',
10+
icon: cardanoImage,
811
fiat: {
912
value: '0',
1013
ticker: 'USD',

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,37 @@ import React from 'react';
33
import ChevronRight from '@icons/ChevronRightComponent';
44

55
import { Flex } from '../flex';
6+
import { Image } from '../profile-picture';
67
import { Text } from '../text';
78

89
import * as cx from './ticker-button.css';
910

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)