fix: hamburger menu sidebar slide-in animation targets sidebarRef instead of backdropRef
This commit is contained in:
+6
-4
@@ -16,12 +16,13 @@ const MENU_ITEMS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default function MainMenu({ onClose, onItemSelect }) {
|
export default function MainMenu({ onClose, onItemSelect }) {
|
||||||
const overlayRef = useRef(null);
|
const sidebarRef = useRef(null);
|
||||||
|
const backdropRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = overlayRef.current;
|
const el = sidebarRef.current;
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
// Trigger enter animation
|
// Trigger enter animation — slide sidebar into view
|
||||||
requestAnimationFrame(() => { el.style.transform = "translateX(0)"; });
|
requestAnimationFrame(() => { el.style.transform = "translateX(0)"; });
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ export default function MainMenu({ onClose, onItemSelect }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={overlayRef}
|
ref={backdropRef}
|
||||||
onClick={handleBackdropClick}
|
onClick={handleBackdropClick}
|
||||||
style={{
|
style={{
|
||||||
position: "fixed", inset: 0, zIndex: 999,
|
position: "fixed", inset: 0, zIndex: 999,
|
||||||
@@ -42,6 +43,7 @@ export default function MainMenu({ onClose, onItemSelect }) {
|
|||||||
>
|
>
|
||||||
{/* Sidebar */}
|
{/* Sidebar */}
|
||||||
<div
|
<div
|
||||||
|
ref={sidebarRef}
|
||||||
style={{
|
style={{
|
||||||
width: 260, maxWidth: "75vw", height: "100%",
|
width: 260, maxWidth: "75vw", height: "100%",
|
||||||
background: T.panel,
|
background: T.panel,
|
||||||
|
|||||||
Reference in New Issue
Block a user