diff --git a/src/app/components/crypto-assets/components/asset-row-grid.tsx b/src/app/components/crypto-assets/components/asset-row-grid.tsx new file mode 100644 index 00000000000..b46b2148003 --- /dev/null +++ b/src/app/components/crypto-assets/components/asset-row-grid.tsx @@ -0,0 +1,20 @@ +import { Grid, GridItem } from 'leather-styles/jsx'; + +interface AssetRowGridProps { + title: React.ReactNode; + balance: React.ReactNode; + caption: React.ReactNode; + usdBalance?: React.ReactNode; +} +export function AssetRowGrid({ title, balance, caption, usdBalance }: AssetRowGridProps) { + return ( + + + {title} + + {balance} + {caption} + {usdBalance && {usdBalance}} + + ); +} diff --git a/src/app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item.layout.tsx b/src/app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item.layout.tsx index 285da32ccb7..99ff750f859 100644 --- a/src/app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item.layout.tsx +++ b/src/app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item.layout.tsx @@ -2,7 +2,7 @@ import { Flex, StackProps } from '@stacks/ui'; import { forwardRefWithAs } from '@stacks/ui-core'; import { truncateMiddle } from '@stacks/ui-utils'; import { CryptoAssetSelectors } from '@tests/selectors/crypto-asset.selectors'; -import { HStack, styled } from 'leather-styles/jsx'; +import { styled } from 'leather-styles/jsx'; import { CryptoCurrencies } from '@shared/models/currencies.model'; import { Money } from '@shared/models/money.model'; @@ -13,6 +13,8 @@ import { usePressable } from '@app/components/item-hover'; import { Flag } from '@app/components/layout/flag'; import { Tooltip } from '@app/components/tooltip'; +import { AssetRowGrid } from '../components/asset-row-grid'; + interface CryptoCurrencyAssetItemLayoutProps extends StackProps { balance: Money; caption: string; @@ -67,31 +69,35 @@ export const CryptoCurrencyAssetItemLayout = forwardRefWithAs( - - - {isHovered ? truncateMiddle(address, 6) : title} - - - - {formattedBalance.value} {additionalBalanceInfo} + + {isHovered ? truncateMiddle(address, 6) : title} - - - - {caption} - - {balance.amount.toNumber() > 0 && address ? ( - {usdBalance} - ) : null} - {additionalUsdBalanceInfo} - - + } + balance={ + + + {formattedBalance.value} {additionalBalanceInfo} + + + } + caption={{caption}} + usdBalance={ + + {balance.amount.toNumber() > 0 && address ? ( + {usdBalance} + ) : null} + {additionalUsdBalanceInfo} + + } + /> {component} diff --git a/src/app/components/crypto-assets/stacks/fungible-token-asset/stacks-fungible-token-asset-item.layout.tsx b/src/app/components/crypto-assets/stacks/fungible-token-asset/stacks-fungible-token-asset-item.layout.tsx index 128e737cdfd..384ade2ed17 100644 --- a/src/app/components/crypto-assets/stacks/fungible-token-asset/stacks-fungible-token-asset-item.layout.tsx +++ b/src/app/components/crypto-assets/stacks/fungible-token-asset/stacks-fungible-token-asset-item.layout.tsx @@ -1,6 +1,6 @@ import { BoxProps } from '@stacks/ui'; import { forwardRefWithAs } from '@stacks/ui-core'; -import { Flex, HStack, styled } from 'leather-styles/jsx'; +import { Flex, styled } from 'leather-styles/jsx'; import type { Money } from '@shared/models/money.model'; @@ -12,6 +12,7 @@ import { Flag } from '@app/components/layout/flag'; import { Tooltip } from '@app/components/tooltip'; import { AssetCaption } from '../../components/asset-caption'; +import { AssetRowGrid } from '../../components/asset-row-grid'; interface StacksFungibleTokenAssetItemLayoutProps extends BoxProps { avatar: string; @@ -45,32 +46,23 @@ export const StacksFungibleTokenAssetItemLayout = forwardRefWithAs( {title[0]} } - spacing="base" + spacing="space.04" width="100%" > - - - {title} - - - - {formattedBalance.value} - - - - - - + {title}} + balance={ + + + {formattedBalance.value} + + + } + caption={} + /> {component}