Skip to content

Commit

Permalink
Refactor getPosition function call
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Dec 2, 2024
1 parent 067ed4d commit 9623132
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ export const MenuRenderer = ({
open: true,
closeReason: CLOSE_REASON_EXIT,
highlightIndex: getNextIndex(-1, state.highlightIndex, itemCount),
triggerPosition:
menuContainerRef && getPosition(menuContainerRef.current),
triggerPosition: getPosition(menuContainerRef.current),
};
}
case MENU_TRIGGER_DOWN:
Expand All @@ -164,8 +163,7 @@ export const MenuRenderer = ({
open: true,
closeReason: CLOSE_REASON_EXIT,
highlightIndex: getNextIndex(1, state.highlightIndex, itemCount),
triggerPosition:
menuContainerRef && getPosition(menuContainerRef.current),
triggerPosition: getPosition(menuContainerRef.current),
};
}
case BACKDROP_CLICK:
Expand Down Expand Up @@ -210,8 +208,7 @@ export const MenuRenderer = ({
open: nextOpen,
closeReason: CLOSE_REASON_EXIT,
highlightIndex: nextOpen ? 0 : CLOSED_INDEX,
triggerPosition:
menuContainerRef && getPosition(menuContainerRef.current),
triggerPosition: getPosition(menuContainerRef.current),
};
}
case MENU_TRIGGER_CLICK: {
Expand All @@ -221,15 +218,13 @@ export const MenuRenderer = ({
...state,
open: nextOpen,
closeReason: CLOSE_REASON_EXIT,
triggerPosition:
menuContainerRef && getPosition(menuContainerRef.current),
triggerPosition: getPosition(menuContainerRef.current),
};
}
case WINDOW_RESIZE: {
return {
...state,
triggerPosition:
menuContainerRef && getPosition(menuContainerRef.current),
triggerPosition: getPosition(menuContainerRef.current),
};
}
default:
Expand Down

0 comments on commit 9623132

Please sign in to comment.