diff --git a/app/streams/page.tsx b/app/streams/page.tsx index e92feeb..fd72bea 100644 --- a/app/streams/page.tsx +++ b/app/streams/page.tsx @@ -235,7 +235,7 @@ export default function AddStream() { Team
-
+
(null); - const buttonRef = useRef(null); const [isOpen, setIsOpen] = useState(controlledIsOpen ?? false); - const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0, width: 0 }); useEffect(() => { const handleClickOutside = (event: MouseEvent) => { if (!dropdownRef.current || !(event.target instanceof Node)) return; - if (dropdownRef.current && !dropdownRef.current.contains(event.target) && - buttonRef.current && !buttonRef.current.contains(event.target)) { + if (dropdownRef.current && !dropdownRef.current.contains(event.target)) { if (onToggle) onToggle(false); else setIsOpen(false); } @@ -43,17 +40,6 @@ export default function Dropdown({ }; }, [controlledIsOpen, isOpen, onToggle]); - useEffect(() => { - if ((controlledIsOpen ?? isOpen) && buttonRef.current) { - const rect = buttonRef.current.getBoundingClientRect(); - setDropdownPosition({ - top: rect.bottom + window.scrollY, - left: rect.left + window.scrollX, - width: rect.width - }); - } - }, [controlledIsOpen, isOpen]); - const activeOption = options.find((option) => option.id === activeId) || null; const handleSelect = (option: { id: number }) => { @@ -68,41 +54,30 @@ export default function Dropdown({ }; return ( - <> -
- -
+ + + {(controlledIsOpen ?? isOpen) && ( -
+
{options.length === 0 ? (
No teams available @@ -120,6 +95,6 @@ export default function Dropdown({ )}
)} - +
); } \ No newline at end of file