BillTracker/client/components/PageTransition.jsx

22 lines
571 B
React
Raw Permalink Normal View History

import { AnimatePresence, motion, useReducedMotion } from 'framer-motion';
export default function PageTransition({ children, routeKey }) {
const reduceMotion = useReducedMotion();
if (reduceMotion) return children;
return (
<AnimatePresence initial={false}>
<motion.div
key={routeKey}
initial={{ opacity: 0, y: 8 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -6 }}
transition={{ duration: 0.18, ease: [0.22, 1, 0.36, 1] }}
>
{children}
</motion.div>
</AnimatePresence>
);
}