Skip to content

Commit

Permalink
Merge pull request #66 from input-output-hk/feat/lw-11733-support-tok…
Browse files Browse the repository at this point in the history
…en-amount-details-tooltip

feat: support TokenAmount details tooltip [LW-11733]
  • Loading branch information
DominikGuzei authored Dec 13, 2024
2 parents 456d99d + 4836445 commit b2e2434
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import { Flex } from '../flex';
import { Text } from '../text';
import { FontWeights } from '../text/create-text.util';
import { Tooltip } from '../tooltip';

import * as cx from './assets-table-token-amount.css';

Expand All @@ -13,21 +14,27 @@ interface Props {
details: string;
detailsColor?: TypographyVariants['color'];
detailsWeight?: FontWeights;
detailsTooltip?: string;
}

export const TokenAmount = ({
amount,
details,
detailsColor = 'secondary',
detailsWeight = '$regular',
detailsTooltip,
}: Readonly<Props>): JSX.Element => {
return (
<Flex flexDirection="column" alignItems="flex-end" className={cx.container}>
<Text.Body.Large weight="$semibold" data-testid="token-amount">
{amount}
</Text.Body.Large>
<Text.Body.Normal color={detailsColor} weight={detailsWeight}>
{details}
{detailsTooltip ? (
<Tooltip label={detailsTooltip}>{details}</Tooltip>
) : (
details
)}
</Text.Body.Normal>
</Flex>
);
Expand Down
1 change: 1 addition & 0 deletions src/design-system/assets-table/assets-table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const PendingAssetInfo = ({ id }: Readonly<AssetInfoProps>): JSX.Element => (
amount="21,584.48"
details="+ 5 pending"
detailsColor="success"
detailsTooltip="Pending coins represent tokens that the wallet recognizes but are not yet finalized by the network. These coins are currently unspendable until confirmed."
/>
</AssetsTable>
);
Expand Down

0 comments on commit b2e2434

Please sign in to comment.