From c075c24630687e1a00773595e39565bedaccec7b Mon Sep 17 00:00:00 2001 From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca> Date: Sun, 6 Apr 2025 15:06:51 -0400 Subject: [PATCH] add useffect to toggle sidebar-ready class after expand transition --- src/Components/Sidebar/index.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Components/Sidebar/index.jsx b/src/Components/Sidebar/index.jsx index b2e4250a5..91068a272 100644 --- a/src/Components/Sidebar/index.jsx +++ b/src/Components/Sidebar/index.jsx @@ -129,6 +129,21 @@ function Sidebar() { ); const sidebarRef = useRef(null); + useEffect(() => { + const el = sidebarRef.current; + if (!el) return; + + const TRANSITION_DURATION = 650; + + if (!collapsed) { + const timeout = setTimeout(() => { + el.classList.add("sidebar-ready"); + }, TRANSITION_DURATION); + return () => clearTimeout(timeout); + } else { + el.classList.remove("sidebar-ready"); + } + }, [collapsed]); const renderAccountMenuItems = () => { let filteredAccountMenuItems = [...accountMenuItems];