24 lines
590 B
TypeScript
24 lines
590 B
TypeScript
"use client"
|
|||
|
|
|
||
|
|
import { motion, AnimatePresence } from "framer-motion"
|
||
|
|
import { usePathname } from "next/navigation"
|
||
|
|
|
||
|
|
export function PageTransition({ children }: { children: React.ReactNode }) {
|
||
|
|
const pathname = usePathname()
|
||
|
|
|
||
|
|
return (
|
||
|
|
<AnimatePresence mode="wait">
|
||
|
|
<motion.div
|
||
|
|
key={pathname}
|
||
|
|
initial={{ opacity: 0, y: 6 }}
|
||
|
|
animate={{ opacity: 1, y: 0 }}
|
||
|
|
exit={{ opacity: 0, y: -4 }}
|
||
|
|
transition={{ duration: 0.18, ease: "easeOut" }}
|
||
|
|
className="h-full"
|
||
|
|
>
|
||
|
|
{children}
|
||
|
|
</motion.div>
|
||
|
|
</AnimatePresence>
|
||
|
|
)
|
||
|
|
}
|