fix: use transform animation for sidebar slide-out panel

- Replace width animation with translateX for GPU acceleration
- Set fixed width on panel and animate x position instead
- Prevents layout recalculation on every animation frame
- Runs on compositor thread without triggering reflow
This commit is contained in:
SohamBhattacharjee2003 2026-04-08 05:26:18 +05:30
parent c7dfbcd95a
commit 63855e0757

View file

@ -91,12 +91,13 @@ export function SidebarSlideOutPanel({
{/* Panel extending from sidebar's right edge, flush with the wrapper border */}
<motion.div
initial={{ width: 0 }}
animate={{ width }}
exit={{ width: 0 }}
style={{ width }}
initial={{ x: -width }}
animate={{ x: 0 }}
exit={{ x: -width }}
transition={{ type: "tween", duration: 0.2, ease: [0.4, 0, 0.2, 1] }}
className="absolute z-20 overflow-hidden"
style={{ left: "100%", top: -1, bottom: -1 }}
style={{ width, left: "100%", top: -1, bottom: -1 }}
>
<div
style={{ width }}