From 0e4c88aa81a1c1b06f48782fa590623bd1be87d0 Mon Sep 17 00:00:00 2001 From: vetalcore Date: Wed, 16 Apr 2025 14:41:03 +0300 Subject: [PATCH] feat: [lw-12577] make fiat optional in assett input, add badge into asset table --- .../asset-input/asset-input.component.tsx | 24 +++++++++++-------- .../asset-input/asset-input.data.ts | 2 +- .../asset-input/ticker-button.component.tsx | 7 ++++-- .../assets-table-token-profile.component.tsx | 20 +++++++++++++--- .../assets-table-token-profile.css.ts | 9 ++++++- .../assets-table/assets-table.stories.tsx | 1 + src/design-tokens/colors.data.ts | 3 +++ src/design-tokens/theme/dark-theme.css.ts | 3 +++ src/design-tokens/theme/light-theme.css.ts | 3 +++ 9 files changed, 55 insertions(+), 17 deletions(-) diff --git a/src/design-system/asset-input/asset-input.component.tsx b/src/design-system/asset-input/asset-input.component.tsx index 53797e7..b72a4c6 100644 --- a/src/design-system/asset-input/asset-input.component.tsx +++ b/src/design-system/asset-input/asset-input.component.tsx @@ -36,13 +36,15 @@ export const AssetInput = ({ - { - onMaxClick?.(state.asset); - }} - /> + {!!onMaxClick && ( + { + onMaxClick?.(state.asset); + }} + /> + )} - - ≈ {state.asset.fiat.value} {state.asset.fiat.ticker} - + {!!state.asset.fiat && ( + + ≈ {state.asset.fiat.value} {state.asset.fiat.ticker} + + )} {state.type === 'invalid' && ( - {name} - + + {name} + + ); diff --git a/src/design-system/assets-table/assets-table-token-profile.component.tsx b/src/design-system/assets-table/assets-table-token-profile.component.tsx index 83e47b7..6ce8d74 100644 --- a/src/design-system/assets-table/assets-table-token-profile.component.tsx +++ b/src/design-system/assets-table/assets-table-token-profile.component.tsx @@ -1,6 +1,7 @@ import React, { ReactElement, ReactNode } from 'react'; import { Box } from '../box'; +import { Flex } from '../flex'; import { Grid, Cell } from '../grid'; import { Image } from '../profile-picture'; import { Text } from '../text'; @@ -16,6 +17,7 @@ type TokenProfileProps = { alt?: string; image: ReactNode; name: ReactNode; + badge?: string; description: ReactNode; testId?: string; }; @@ -24,6 +26,7 @@ export const TokenProfile = ({ alt, image, name, + badge, description, testId = 'token-profile', }: Readonly): ReactElement => { @@ -45,9 +48,20 @@ export const TokenProfile = ({ {imageNode} - - {name} - + + + {name} + + {!!badge && ( + + {badge} + + )} +