diff --git a/app/components/Sidebar/Aside.tsx b/app/components/Sidebar/Aside.tsx index 38579bf10b..5f825127b2 100644 --- a/app/components/Sidebar/Aside.tsx +++ b/app/components/Sidebar/Aside.tsx @@ -20,12 +20,6 @@ interface Props extends React.HTMLAttributes { skipInitialAnimation?: boolean; } -const slideTransition: Transition = { - type: "spring", - bounce: 0, - duration: sidebarAppearDuration / 1000, -}; - function Aside({ children, border, className, skipInitialAnimation }: Props) { const theme = useTheme(); const { ui } = useStores(); @@ -95,13 +89,11 @@ function Aside({ children, border, className, skipInitialAnimation }: Props) { duration: sidebarAppearDuration / 1000, }; - // The reserved width changes in one step so that the content beside the - // sidebar reflows once, rather than on every frame of the animation. const animationProps = { initial: skipInitialAnimation ? false : { - width: ui.sidebarRightWidth, + width: 0, opacity: 0.9, }, animate: { @@ -110,26 +102,18 @@ function Aside({ children, border, className, skipInitialAnimation }: Props) { opacity: 1, }, exit: { + width: 0, opacity: 0, - transition: slideTransition, }, }; // The inner element is positioned out of flow, so it must follow the same width to stay in step - // with the container it visually fills. It slides into place with a transform, which does not - // cause layout. - const offscreenX = - direction === "rtl" ? -ui.sidebarRightWidth : ui.sidebarRightWidth; + // with the container it visually fills. const positionAnimationProps = { - initial: skipInitialAnimation ? false : { x: offscreenX }, + initial: false, animate: { - transition: { ...transition, x: slideTransition }, + transition, width: ui.sidebarRightWidth - (windowScrollbarWidth ?? 0), - x: 0, - }, - exit: { - x: offscreenX, - transition: slideTransition, }, };