mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
parent
79f461f5c9
commit
3548c984a9
@ -66,13 +66,19 @@ export function Dropdown(props: DropdownProps) {
|
|||||||
[setOpen, updatePos]
|
[setOpen, updatePos]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
const close = useCallback(() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
},[]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
close();
|
||||||
}, [pathname]);
|
}, [pathname]);
|
||||||
|
|
||||||
useOutsideClick(dropdownRef, () => {
|
useOutsideClick(dropdownRef, close);
|
||||||
setOpen(false);
|
|
||||||
});
|
const onOptionsClick = useCallback((e: any) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box flexShrink={props?.flexShrink ? props.flexShrink : 1} position={open ? "relative" : "static"} minWidth='0' width={props?.width ? props.width : 'auto'}>
|
<Box flexShrink={props?.flexShrink ? props.flexShrink : 1} position={open ? "relative" : "static"} minWidth='0' width={props?.width ? props.width : 'auto'}>
|
||||||
@ -85,6 +91,7 @@ export function Dropdown(props: DropdownProps) {
|
|||||||
width={props?.dropWidth || "max-content"}
|
width={props?.dropWidth || "max-content"}
|
||||||
{...coords}
|
{...coords}
|
||||||
ref={dropdownRef}
|
ref={dropdownRef}
|
||||||
|
onClick={onOptionsClick}
|
||||||
>
|
>
|
||||||
{options}
|
{options}
|
||||||
</DropdownOptions>
|
</DropdownOptions>
|
||||||
|
Loading…
Reference in New Issue
Block a user