mirror of
https://github.com/outline/outline.git
synced 2026-11-27 07:58:51 +03:00
Revert "perf: Slide the right sidebar with a transform instead of animating i…" (#14093)
This reverts commit 01802ef3b9.
This commit is contained in:
1 parent
9669b2d823
commit
08b3896cfc
1 file changed
+5
-21
@@ -20,12 +20,6 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
||||
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,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user