From a16fcd5cd13afa9f0fbc5fd0916637294f4c58eb Mon Sep 17 00:00:00 2001 From: woody <125113430+woodenfurniture@users.noreply.github.com> Date: Tue, 17 Sep 2024 20:46:49 +1000 Subject: [PATCH] fix: handle long asset names in send input (#7751) --- src/components/AccountCard.tsx | 54 +++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/src/components/AccountCard.tsx b/src/components/AccountCard.tsx index 9426f735a56..a19440fccb3 100644 --- a/src/components/AccountCard.tsx +++ b/src/components/AccountCard.tsx @@ -1,8 +1,8 @@ import { ChevronRightIcon } from '@chakra-ui/icons' import type { ButtonProps } from '@chakra-ui/react' -import { Button, SkeletonCircle, SkeletonText } from '@chakra-ui/react' +import { Box, Button, SkeletonCircle, SkeletonText, Tooltip } from '@chakra-ui/react' import type { Asset } from '@shapeshiftoss/types' -import { useMemo } from 'react' +import { useCallback, useMemo, useState } from 'react' import { useTranslate } from 'react-polyglot' import { Amount } from './Amount/Amount' @@ -18,7 +18,9 @@ type AccountCardProps = { onClick?: () => void } & ButtonProps -const chevronRightIcon = +const leftIconBoxSize = '40px' +const rightIconBoxSize = 6 +const chevronRightIcon = export const AccountCard = ({ asset, @@ -32,13 +34,22 @@ export const AccountCard = ({ const translate = useTranslate() const buttonLeftIcon = useMemo( () => ( - - + + ), [asset.assetId, isLoaded], ) + const [willOverflow, setWillOverflow] = useState(false) + + const checkOverflow = useCallback((el: HTMLElement | null) => { + if (el) { + const isOverflowing = el.scrollWidth > el.clientWidth + setWillOverflow(isOverflowing) + } + }, []) + return (