From 865140a2059fff07ba6e3117ff939e84e8944891 Mon Sep 17 00:00:00 2001 From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca> Date: Mon, 7 Apr 2025 15:29:18 -0400 Subject: [PATCH] create sidebarClassName variable and update in jsx --- src/Components/Sidebar/index.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Components/Sidebar/index.jsx b/src/Components/Sidebar/index.jsx index 0d760661f..8d65acdde 100644 --- a/src/Components/Sidebar/index.jsx +++ b/src/Components/Sidebar/index.jsx @@ -129,13 +129,14 @@ function Sidebar() { ); const sidebarRef = useRef(null); const [sidebarReady, setSidebarReady] = useState(false); + const TRANSITION_DURATION = 200; useEffect(() => { if (!collapsed) { setSidebarReady(false); const timeout = setTimeout(() => { setSidebarReady(true); - }, 200); + }, TRANSITION_DURATION); return () => clearTimeout(timeout); } else { setSidebarReady(false); @@ -205,13 +206,14 @@ function Sidebar() { }, [location]); const iconColor = theme.palette.primary.contrastTextTertiary; + const sidebarClassName = `${collapsed ? "collapsed" : "expanded"} ${sidebarReady ? "sidebar-ready" : ""}`; /* TODO refactor this, there are a some ternaries and comments in the return */ return (