Files
koring-space/components/page-transition.tsx
T

23 lines
571 B
TypeScript

"use client";
import { usePathname } from "next/navigation";
import { AnimatePresence, motion } from "motion/react";
export function PageTransition({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
return (
<AnimatePresence mode="wait">
<motion.div
key={pathname}
initial={{ opacity: 0, x: 40 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -40 }}
transition={{ duration: 0.25, ease: "easeInOut" }}
>
{children}
</motion.div>
</AnimatePresence>
);
}