From 52ab6ff5c9c89d34d4c959f99adba2f1b079d85b Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Fri, 7 Jun 2024 13:27:11 +0300 Subject: [PATCH] Shared:ContextMenu:Refactoring. --- packages/shared/components/context-menu/ContextMenu.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/shared/components/context-menu/ContextMenu.tsx b/packages/shared/components/context-menu/ContextMenu.tsx index bc6eb24015..66998b4a53 100644 --- a/packages/shared/components/context-menu/ContextMenu.tsx +++ b/packages/shared/components/context-menu/ContextMenu.tsx @@ -53,7 +53,7 @@ import { MobileSubMenu } from "./sub-components/MobileSubMenu"; import { ContextMenuModel, ContextMenuProps } from "./ContextMenu.types"; -const marginTop = 16; // Indentation from the top border of the screen +const marginBorder = 16; // Indentation from the border of the screen const ContextMenu = React.forwardRef((props: ContextMenuProps, ref) => { const [visible, setVisible] = React.useState(false); @@ -281,7 +281,7 @@ const ContextMenu = React.forwardRef((props: ContextMenuProps, ref) => { // fit if (top < document.body.scrollTop) { - if (document.body.scrollTop === 0) top = marginTop; + if (document.body.scrollTop === 0) top = marginBorder; else top = document.body.scrollTop; } @@ -296,7 +296,7 @@ const ContextMenu = React.forwardRef((props: ContextMenuProps, ref) => { } } if (menuRef.current) { - menuRef.current.style.left = `${left || 16}px`; + menuRef.current.style.left = `${left || marginBorder}px`; menuRef.current.style.top = `${top}px`; if (!mobileView) menuRef.current.style.width = `${width}px`;