Refactor dropdown (#1561)

This commit is contained in:
Charles Bochet
2023-09-13 01:30:33 -07:00
committed by GitHub
parent 84b474c3cc
commit 67f1da038d
12 changed files with 166 additions and 152 deletions

View File

@ -22,6 +22,7 @@ type OwnProps = {
};
dropdownHotkeyScope?: HotkeyScope;
dropdownPlacement?: Placement;
onDropdownToggle?: (isDropdownOpen: boolean) => void;
};
export function DropdownButton({
@ -31,12 +32,14 @@ export function DropdownButton({
hotkey,
dropdownHotkeyScope,
dropdownPlacement = 'bottom-end',
onDropdownToggle,
}: OwnProps) {
const containerRef = useRef<HTMLDivElement>(null);
const { isDropdownButtonOpen, toggleDropdownButton, closeDropdownButton } =
useDropdownButton({
key: dropdownKey,
onDropdownToggle,
});
const { refs, floatingStyles } = useFloating({