From 8d656ba2678611d34a5c2ef889383a45422f54c4 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 24 Oct 2023 00:28:15 -0400 Subject: [PATCH] styling updates --- src/app/components/PairSelector.tsx | 40 +++++++++++++++++------------ 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/app/components/PairSelector.tsx b/src/app/components/PairSelector.tsx index f356336a..c6431077 100644 --- a/src/app/components/PairSelector.tsx +++ b/src/app/components/PairSelector.tsx @@ -91,37 +91,42 @@ export function PairSelector() { }; const options = pairSelector.pairsList; const id = "pairOption"; - const selectedVal = pairSelector.pairsList[0] + let selectedVal = pairSelector.pairsList[0] ? pairSelector.pairsList[0].name : "Loading"; const handleChange = (val) => { - console.log(val); selectPair(val); }; const [query, setQuery] = useState(""); - const [isOpen, setIsOpen] = useState(false); + const [isOpen, setIsOpen] = useState(true); const inputRef = useRef(null); - + const dropdownRef = useRef(null); + /* useEffect(() => { document.addEventListener("click", toggle); return () => document.removeEventListener("click", toggle); }, []); - +*/ const selectOption = (option) => { setQuery(() => ""); handleChange(option["address"]); + console.log(option); + selectedVal = option["name"]; setIsOpen((isOpen) => !isOpen); }; function toggle(e) { + console.log(inputRef.current); setIsOpen(e && e.target === inputRef.current); } const getDisplayValue = () => { - if (query) return query; - if (selectedVal) return selectedVal; + console.log("query %s", query); + console.log("sel %s", selectedVal); + if (query) return displayName(query); + if (selectedVal) return displayName(selectedVal); return ""; }; @@ -134,9 +139,9 @@ export function PairSelector() { return (
-
-