File tree Expand file tree Collapse file tree 3 files changed +29
-20
lines changed
src/design-system/asset-input Expand file tree Collapse file tree 3 files changed +29
-20
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
13export interface Asset {
24 id : string ;
35 ticker : string ;
46 balance : string ;
57 amount : string ;
6- icon ?: string ;
8+ icon ?: string | React . ReactNode ;
79}
810
911export interface AssetWithFiat extends Asset {
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
13import cardanoImage from '../../assets/images/cardano-blue-bg.png' ;
4+ import { Image } from '../profile-picture' ;
25
36import type { AssetWithFiat , AssetState } from './asset-input.data' ;
47
@@ -7,7 +10,7 @@ export const asset: AssetWithFiat = {
710 amount : '' ,
811 id : '' ,
912 ticker : 'Token' ,
10- icon : cardanoImage ,
13+ icon : < Image imageSrc = { cardanoImage } /> ,
1114 fiat : {
1215 value : '0' ,
1316 ticker : 'USD' ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import * as cx from './ticker-button.css';
1111interface Props {
1212 name : string ;
1313 id : string ;
14- icon ?: string ;
14+ icon ?: string | React . ReactNode ;
1515 onClick ?: ( ) => void ;
1616}
1717
@@ -20,20 +20,24 @@ export const TickerButton = ({
2020 id,
2121 icon,
2222 onClick,
23- } : Readonly < Props > ) : JSX . Element => (
24- < button
25- className = { cx . button }
26- onClick = { onClick }
27- data-testid = { `asset-input-ticker-button-${ id } ` }
28- >
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 >
38- </ button >
39- ) ;
23+ } : Readonly < Props > ) : JSX . Element => {
24+ const isIconString = typeof icon === 'string' ;
25+
26+ return (
27+ < button
28+ className = { cx . button }
29+ onClick = { onClick }
30+ data-testid = { `asset-input-ticker-button-${ id } ` }
31+ >
32+ < Flex alignItems = "center" gap = "$16" >
33+ { isIconString ? < Image imageSrc = { icon } alt = "Token" /> : icon }
34+ < Text . SubHeading weight = "$bold" >
35+ < Flex justifyContent = "center" alignItems = "center" >
36+ < span > { name } </ span >
37+ < ChevronRight className = { cx . chevronIcon } />
38+ </ Flex >
39+ </ Text . SubHeading >
40+ </ Flex >
41+ </ button >
42+ ) ;
43+ } ;
You can’t perform that action at this time.
0 commit comments