Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: layout issue when stacking #4857

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/app/components/caption-dot-separator.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { cloneElement, isValidElement } from 'react';

import { BoxProps, styled } from 'leather-styles/jsx';
import { Circle, CircleProps } from 'leather-styles/jsx';

function CaptionSeparatorDot(props: BoxProps) {
return (
<styled.span color="accent.text-subdued" fontSize="10px" {...props}>
</styled.span>
);
export function CaptionSeparatorDot(props: CircleProps) {
kyranjamie marked this conversation as resolved.
Show resolved Hide resolved
return <Circle display="inline-flex" backgroundColor="currentColor" size="3px" {...props} />;
kyranjamie marked this conversation as resolved.
Show resolved Hide resolved
}

interface CaptionDotSeparatorProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ export function AssetRowGrid({
<GridItem textAlign="right">{balance}</GridItem>
);
return (
<Grid columns={2} gridTemplateColumns="2fr 1fr" gridTemplateRows={2} gap={0}>
<Grid
columns={2}
gridTemplateColumns="2fr 1fr"
gridTemplateRows={2}
gap={0}
whiteSpace="nowrap"
>
<GridItem textAlign="left" whiteSpace="nowrap" overflow="hidden" textOverflow="ellipsis">
{title}
</GridItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,17 @@ export function CryptoCurrencyAssetItemLayout({
</styled.span>
</BasicTooltip>
}
caption={<styled.span textStyle="caption.02">{caption}</styled.span>}
caption={
<styled.span textStyle="caption.02" color="accent.text-subdued">
{caption}
</styled.span>
}
usdBalance={
<Flex justifyContent="flex-end">
{balance.amount.toNumber() > 0 && address ? (
<styled.span textStyle="caption.02">{usdBalance}</styled.span>
<styled.span textStyle="caption.02" color="accent.text-subdued">
{usdBalance}
</styled.span>
) : null}
{additionalUsdBalanceInfo}
</Flex>
Expand Down
13 changes: 11 additions & 2 deletions src/app/features/asset-list/components/stacks-asset-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { styled } from 'leather-styles/jsx';

import { useStxBalance } from '@app/common/hooks/balance/stx/use-stx-balance';
import { ftDecimals } from '@app/common/stacks-utils';
import { CaptionSeparatorDot } from '@app/components/caption-dot-separator';
import { CryptoCurrencyAssetItem } from '@app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item';
import { StxAvatar } from '@app/components/crypto-assets/stacks/components/stx-avatar';
import { useStacksFungibleTokenAssetBalancesAnchoredWithMetadata } from '@app/query/stacks/balance/stacks-ft-balances.hooks';
Expand All @@ -20,11 +23,17 @@ export function StacksAssetList({ account }: StacksAssetListProps) {
useStxBalance();

const stxAdditionalBalanceInfo = stxLockedBalance?.amount.isGreaterThan(0) ? (
<>({ftDecimals(stxLockedBalance.amount, stxLockedBalance.decimals || 0)} locked)</>
<styled.span>
<CaptionSeparatorDot mr="space.01" pos="relative" top="-2px" />
{ftDecimals(stxLockedBalance.amount, stxLockedBalance.decimals || 0)} locked
</styled.span>
) : undefined;

const stxAdditionalUsdBalanceInfo = stxLockedBalance?.amount.isGreaterThan(0) ? (
<Caption ml="4px">({stxUsdLockedBalance} locked)</Caption>
<Caption ml="4px">
<CaptionSeparatorDot mr="space.01" pos="relative" top="-1px" />
{stxUsdLockedBalance} locked
</Caption>
) : undefined;

return (
Expand Down
Loading