From 7ccd74b02233669c60ffe3c227413eb4061e7c2e Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Tue, 15 Oct 2024 02:05:25 +0530 Subject: [PATCH] fix(help): ui --- frontend/src/Navigation.tsx | 4 +-- frontend/src/components/Help.tsx | 62 ++++++++++++-------------------- 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 6e3b6818..4b49ddbc 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -361,9 +361,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
-
- -
+
{ const [isOpen, setIsOpen] = useState(false); @@ -30,62 +30,44 @@ const Help = () => { }; }, []); - const dropdownPosition = () => { - if (!buttonRef.current) return { top: '100%', left: '0' }; - - const rect = buttonRef.current.getBoundingClientRect(); - const dropdownHeight = 80; // Adjust based on the content height - const spaceBelow = window.innerHeight - rect.bottom; - - const dropdownWidth = 192; // Adjust to fit your design - const spaceRight = window.innerWidth - rect.right; - - let leftPosition = 0; // Default to align with the button - - if (spaceRight < dropdownWidth) { - leftPosition = dropdownWidth - rect.width; - } - - if (spaceBelow >= dropdownHeight) { - return { top: '100%', left: `${leftPosition}px` }; // Open downward - } else { - return { top: `${-dropdownHeight}px`, left: `${leftPosition}px` }; // Open upward - } - }; - return ( -
+