From 83c846ae8a35c1d72f167a50dd76b12be5cf5e31 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 5 Nov 2022 15:26:09 +0100 Subject: [PATCH] Update AmountOut.js --- .../react-app/src/components/AmountOut.js | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/packages/react-app/src/components/AmountOut.js b/packages/react-app/src/components/AmountOut.js index 698b621..6fdf1bb 100644 --- a/packages/react-app/src/components/AmountOut.js +++ b/packages/react-app/src/components/AmountOut.js @@ -6,62 +6,62 @@ import { useAmountsOut, useOnClickOutside } from "../utils"; import styles from "../styles"; const AmountOut = ({ fromToken, toToken, amountIn, pairContract, currencyValue, onSelect, currencies }) => { - const [showList, setShowList] = useState(false); - const [activeCurrency, setActiveCurrency] = useState("Select"); - const ref = useRef() + const [showList, setShowList] = useState(false); + const [activeCurrency, setActiveCurrency] = useState("Select"); + const ref = useRef() - const amountOut = useAmountsOut(pairContract, amountIn, fromToken, toToken) ?? 0; + const amountOut = useAmountsOut(pairContract, amountIn, fromToken, toToken) ?? 0; - useOnClickOutside(ref, () => setShowList(false)) + useOnClickOutside(ref, () => setShowList(false)) - useEffect(() => { - if (Object.keys(currencies).includes(currencyValue)) { - setActiveCurrency(currencies[currencyValue]); - } else { - setActiveCurrency("Select") - } - }, [currencyValue, currencies]); + useEffect(() => { + if (Object.keys(currencies).includes(currencyValue)) { + setActiveCurrency(currencies[currencyValue]); + } else { + setActiveCurrency("Select") + } + }, [currencyValue, currencies]); - return ( -
- + return ( +
+ -
setShowList(!showList)}> - +
setShowList(!showList)}> + - {showList && ( -
    - {Object.entries(currencies).map(([token, tokenName], index) => ( -
  • { - if (typeof onSelect === "function") onSelect(token); - setActiveCurrency(tokenName); - setShowList(false); - }} - > - {tokenName} -
  • - ))} -
- )} -
-
- ); + {showList && ( +
    + {Object.entries(currencies).map(([token, tokenName], index) => ( +
  • { + if (typeof onSelect === "function") onSelect(token); + setActiveCurrency(tokenName); + setShowList(false); + }} + > + {tokenName} +
  • + ))} +
+ )} +
+
+ ); }; export default AmountOut;