Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
29 lines
655 B
TypeScript
29 lines
655 B
TypeScript
"use client";
|
|
|
|
import { AnimatePresence, motion } from "framer-motion";
|
|
import { usePathname } from "next/navigation";
|
|
import { ReactNode } from "react";
|
|
|
|
export function PageTransition({ children }: { children: ReactNode }) {
|
|
const pathname = usePathname();
|
|
|
|
return (
|
|
<AnimatePresence mode="wait">
|
|
<motion.div
|
|
key={pathname}
|
|
initial={false}
|
|
animate={{ opacity: 1, y: 0 }}
|
|
exit={{ opacity: 0, y: -12 }}
|
|
transition={{
|
|
type: "spring",
|
|
stiffness: 260,
|
|
damping: 25,
|
|
mass: 0.8,
|
|
}}
|
|
>
|
|
{children}
|
|
</motion.div>
|
|
</AnimatePresence>
|
|
);
|
|
}
|