From 27320d902d7bf8ca9494c7eed7f88e5174ee6d9e Mon Sep 17 00:00:00 2001 From: Alissa Crane Date: Tue, 17 Dec 2024 14:50:08 -0800 Subject: [PATCH] adjust styling --- src/buy/components/Buy.tsx | 4 +++- src/buy/components/BuyAmountInput.tsx | 13 ++++++++++--- src/buy/components/BuyButton.tsx | 15 ++++++++++++--- src/buy/components/BuyDropdown.tsx | 4 ++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/buy/components/Buy.tsx b/src/buy/components/Buy.tsx index 693ed6bfdb..302b16caef 100644 --- a/src/buy/components/Buy.tsx +++ b/src/buy/components/Buy.tsx @@ -1,5 +1,6 @@ import { useOutsideClick } from '@/ui-react/internal/hooks/useOutsideClick'; import { useRef } from 'react'; +import { useTheme } from '../../core-react/internal/hooks/useTheme'; import { cn } from '../../styles/theme'; import { FALLBACK_DEFAULT_MAX_SLIPPAGE } from '../../swap/constants'; import type { BuyReact } from '../types'; @@ -10,6 +11,7 @@ import { BuyMessage } from './BuyMessage'; import { BuyProvider, useBuyContext } from './BuyProvider'; function BuyContent({ className }: { className?: string }) { + const componentTheme = useTheme(); const { isDropdownOpen, setIsDropdownOpen } = useBuyContext(); const buyContainerRef = useRef(null); @@ -22,7 +24,7 @@ function BuyContent({ className }: { className?: string }) { return (
diff --git a/src/buy/components/BuyAmountInput.tsx b/src/buy/components/BuyAmountInput.tsx index e40e820ff0..7350145419 100644 --- a/src/buy/components/BuyAmountInput.tsx +++ b/src/buy/components/BuyAmountInput.tsx @@ -1,6 +1,6 @@ import { isValidAmount } from '../../core/utils/isValidAmount'; import { TextInput } from '../../internal/components/TextInput'; -import { cn, color } from '../../styles/theme'; +import { background, cn, color } from '../../styles/theme'; import { formatAmount } from '../../swap/utils/formatAmount'; import { TokenChip } from '../../token'; import { useBuyContext } from './BuyProvider'; @@ -13,11 +13,18 @@ export function BuyAmountInput() { } return ( -
+
{ - setIsDropdownOpen(true); - }, [setIsDropdownOpen]); + if (isDropdownOpen) { + setIsDropdownOpen(false); + } else { + setIsDropdownOpen(true); + } + }, [setIsDropdownOpen, isDropdownOpen]); const buttonContent = useMemo(() => { if (statusName === 'success') { return checkmarkSvg; } + if (isDropdownOpen) { + return closeSvg; + } return 'Buy'; - }, [statusName]); + }, [statusName, isDropdownOpen]); if (!isDisabled && !address) { return ; diff --git a/src/buy/components/BuyDropdown.tsx b/src/buy/components/BuyDropdown.tsx index b195148d74..21c276060a 100644 --- a/src/buy/components/BuyDropdown.tsx +++ b/src/buy/components/BuyDropdown.tsx @@ -64,9 +64,9 @@ export function BuyDropdown() {
Buy with