23 lines
646 B
TypeScript
23 lines
646 B
TypeScript
"use client";
|
|
|
|
import { motion } from "framer-motion";
|
|
import { usePathname } from "next/navigation";
|
|
import { ReactNode } from "react";
|
|
|
|
export default function PageTransition({ children }: { children: ReactNode }) {
|
|
const pathname = usePathname();
|
|
|
|
return (
|
|
<motion.div
|
|
key={pathname}
|
|
initial={{ opacity: 0, y: 20, filter: 'blur(10px)' }}
|
|
animate={{ opacity: 1, y: 0, filter: 'blur(0px)' }}
|
|
exit={{ opacity: 0, y: -20, filter: 'blur(10px)' }}
|
|
transition={{ duration: 0.4, type: "spring" as const, bounce: 0.2 }}
|
|
className="flex-1 w-full flex flex-col"
|
|
>
|
|
{children}
|
|
</motion.div>
|
|
);
|
|
}
|