From b3c44f20d7ed16563e928a78131a47783f756685 Mon Sep 17 00:00:00 2001 From: Jordan Frankfurt Date: Wed, 26 Oct 2022 10:37:35 -0500 Subject: [PATCH] fix: bag footer layout (#5003) * fix: bag footer layout * pr feedback * remove balance from footer --- src/nft/components/bag/Bag.tsx | 9 ++--- src/nft/components/bag/BagFooter.tsx | 56 ++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/nft/components/bag/Bag.tsx b/src/nft/components/bag/Bag.tsx index bc1bcd829c..2e1d7e8790 100644 --- a/src/nft/components/bag/Bag.tsx +++ b/src/nft/components/bag/Bag.tsx @@ -123,11 +123,9 @@ const Bag = () => { return { totalEthPrice, totalUsdPrice } }, [itemsInBag, fetchedPriceData]) - const { balance, sufficientBalance } = useMemo(() => { - const balance: BigNumber = parseEther(balanceInEth.toString()) - const sufficientBalance = isConnected ? BigNumber.from(balance).gte(totalEthPrice) : true - - return { balance, sufficientBalance } + const sufficientBalance = useMemo(() => { + const balance = parseEther(balanceInEth.toString()) + return isConnected ? BigNumber.from(balance).gte(totalEthPrice) : true }, [balanceInEth, totalEthPrice, isConnected]) const purchaseAssets = async (routingData: RouteResponse) => { @@ -278,7 +276,6 @@ const Bag = () => { {hasAssetsToShow && !isProfilePage && ( ` + border-top: 1px solid ${({ theme }) => theme.backgroundOutline}; + color: ${({ theme }) => theme.textPrimary}; + display: flex; + flex-direction: column; + padding: 12px 16px; + border-bottom-left-radius: 12px; + border-bottom-right-radius: 12px; + border-top-left-radius: ${({ $showWarning }) => ($showWarning ? '0' : '12')}px; + border-top-right-radius: ${({ $showWarning }) => ($showWarning ? '0' : '12')}px; +` + +const WarningIcon = styled(AlertTriangle)` + width: 14px; + margin-right: 4px; + color: ${({ theme }) => theme.accentWarning}; +` +const WarningText = styled(ThemedText.BodyPrimary)` + align-items: center; + color: ${({ theme }) => theme.accentWarning}; + display: flex; + justify-content: center; + margin: 12px 0 !important; + text-align: center; +` + interface BagFooterProps { - balance: BigNumber isConnected: boolean sufficientBalance: boolean totalEthPrice: BigNumber @@ -30,7 +58,6 @@ const PENDING_BAG_STATUSES = [ ] export const BagFooter = ({ - balance, isConnected, sufficientBalance, totalEthPrice, @@ -49,18 +76,7 @@ export const BagFooter = ({ return ( - {showWarning && ( - - {!sufficientBalance - ? `Insufficient funds (${formatWeiToDecimal(balance.toString())} ETH)` - : `Something went wrong. Please try again.`} - - )} - + ) }