editor: fix dropdown needing 2 clicks to open

This commit is contained in:
Abdullah Atta
2023-03-18 12:27:11 +05:00
committed by Abdullah Atta
parent 0d714847f3
commit b1d4ccc27e

View File

@@ -45,7 +45,7 @@ export function Dropdown(props: DropdownProps) {
const isMobile = useIsMobile();
const isBottom = toolbarLocation === "bottom";
const { closePopup, isPopupOpen } = usePopupHandler({
const { isPopupOpen } = usePopupHandler({
group,
id,
isOpen,
@@ -82,7 +82,15 @@ export function Dropdown(props: DropdownProps) {
selectedItem
)}
<Icon
path={isBottom ? Icons.chevronUp : Icons.chevronDown}
path={
isBottom
? isPopupOpen
? Icons.chevronDown
: Icons.chevronUp
: isPopupOpen
? Icons.chevronUp
: Icons.chevronDown
}
size={"small"}
color={"text"}
/>
@@ -91,7 +99,7 @@ export function Dropdown(props: DropdownProps) {
<MenuPresenter
isOpen={isPopupOpen}
items={items}
onClose={() => closePopup(id)}
onClose={() => setIsOpen(false)}
position={{
target: isBottom
? getToolbarElement()