Files
mugladijitalmedya/components/ClientWrapper.tsx

29 lines
909 B
TypeScript

"use client";
import { usePathname } from "next/navigation";
import { motion, AnimatePresence } from "framer-motion";
import Navbar from "./Navbar";
import Footer from "./Footer";
export default function ClientLayout({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
const isAdmin = pathname?.startsWith("/admin");
return (
<>
{!isAdmin && <Navbar />}
<AnimatePresence mode="wait">
<motion.div
key={pathname}
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -10 }}
transition={{ duration: 0.4, ease: "easeOut" }}
>
{children}
</motion.div>
</AnimatePresence>
{!isAdmin && <Footer />}
</>
);
}