fix: open menu to the top when at the bottom of the screen

This commit is contained in:
Antonella Sgarlatta
2021-05-07 18:35:02 -03:00
parent 437aa40d7a
commit 24eb348b08
3 changed files with 18 additions and 8 deletions

View File

@@ -16,6 +16,8 @@ type Props = {
onSubmenuChange?: (submenuOpen: boolean) => void;
};
const MAX_TAGS_MENU_HEIGHT = 265;
export const NotesOptions = observer(
({ appState, closeOnBlur, setLockCloseOnBlur, onSubmenuChange }: Props) => {
const [tagsMenuOpen, setTagsMenuOpen] = useState(false);
@@ -84,7 +86,7 @@ export const NotesOptions = observer(
setTagsMenuPosition({
top: offsetTop,
right:
buttonRect.right + 265 > document.body.clientWidth
buttonRect.right + MAX_TAGS_MENU_HEIGHT > document.body.clientWidth
? offsetWidth
: -offsetWidth,
});