diff --git a/src/components/Swap/Input.tsx b/src/components/Swap/Input.tsx index cb8d747d7..32ef7ae71 100644 --- a/src/components/Swap/Input.tsx +++ b/src/components/Swap/Input.tsx @@ -79,20 +79,20 @@ export function useFormattedFieldAmount({ }, [currencyAmount, fieldAmount]) } -interface InputWrapperProps { +interface FieldWrapperProps { field: Field impact?: PriceImpact maxAmount?: string isSufficientBalance?: boolean } -export function InputWrapper({ +export function FieldWrapper({ field, impact, maxAmount, isSufficientBalance, className, -}: InputWrapperProps & { className?: string }) { +}: FieldWrapperProps & { className?: string }) { const { [field]: { balance, amount: currencyAmount, usdc }, error, @@ -118,7 +118,7 @@ export function InputWrapper({ const isDisabled = error !== undefined const isRouteLoading = isDisabled || tradeState === TradeState.LOADING - const isDependentField = !useIsSwapFieldIndependent(Field.INPUT) + const isDependentField = !useIsSwapFieldIndependent(field) const isLoading = isRouteLoading && isDependentField const isWrap = useIsWrap() @@ -141,7 +141,7 @@ export function InputWrapper({ amount={formattedAmount} currency={currency} disabled={isDisabled} - field={Field.INPUT} + field={field} onChangeInput={updateAmount} onChangeCurrency={updateCurrency} loading={isLoading} @@ -192,5 +192,5 @@ export default function Input() { return max.toExact() }, [balance, currencyAmount]) - return + return } diff --git a/src/components/Swap/Output.tsx b/src/components/Swap/Output.tsx index 016522b0c..c9b451fd9 100644 --- a/src/components/Swap/Output.tsx +++ b/src/components/Swap/Output.tsx @@ -6,11 +6,11 @@ import { Field } from 'state/swap' import styled from 'styled-components/macro' import { DynamicThemeProvider } from 'theme' -import { InputWrapper } from './Input' +import { FieldWrapper } from './Input' export const colorAtom = atom(undefined) -const OutputWrapper = styled(InputWrapper)<{ hasColor?: boolean | null }>` +const OutputWrapper = styled(FieldWrapper)<{ hasColor?: boolean | null }>` border-bottom: 1px solid ${({ theme }) => theme.container}; border-bottom-left-radius: 0; border-bottom-right-radius: 0;