From 8b4004d9877f355eb352621ed5ea85e779349b4b Mon Sep 17 00:00:00 2001 From: Kavlin Kaur Date: Sun, 10 Aug 2025 23:03:46 +0530 Subject: [PATCH] feat: add route-keyed page transitions with Framer Motion --- app/clientLayout.tsx | 54 ++++++++++++++++++++------------------------ app/layout.tsx | 20 ++++++++++------ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/app/clientLayout.tsx b/app/clientLayout.tsx index f8bc8e6..bf48cbb 100644 --- a/app/clientLayout.tsx +++ b/app/clientLayout.tsx @@ -4,15 +4,14 @@ import type React from "react" import { Inter } from "next/font/google" import { motion, AnimatePresence } from "framer-motion" +import { usePathname } from "next/navigation" import { ThemeProvider } from "@/components/theme-provider" import { Navbar } from "@/components/navbar" import { Footer } from "@/components/footer" -import {Toaster} from "react-hot-toast" +import { Toaster } from "react-hot-toast" import AuthProvider from '../context/AuthProvider'; -import "./globals.css" - const inter = Inter({ subsets: ["latin"] }) export default function ClientLayout({ @@ -20,32 +19,29 @@ export default function ClientLayout({ }: Readonly<{ children: React.ReactNode }>) { + const pathname = usePathname() return ( - - - - -
- -
- - - {children} - - -
-
-
- - -
- -
- + + +
+ +
+ + + {children} + + +
+
+
+ +
+
) } diff --git a/app/layout.tsx b/app/layout.tsx index d111d61..9ef25d9 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,12 +3,13 @@ import type { Metadata } from "next" import ClientLayout from "./clientLayout" import { Analytics } from "@vercel/analytics/next" +import "./globals.css" export const metadata: Metadata = { title: "LegalEase - Simplifying Legal Access for All", description: "LegalEase makes the justice system accessible through AI-powered tools, plain language explanations, and personalized guidance.", - generator: 'v0.dev' + generator: "v0.dev", } export default function RootLayout({ @@ -16,9 +17,14 @@ export default function RootLayout({ }: Readonly<{ children: React.ReactNode }>) { - return( - {children} -)} - - -import './globals.css' \ No newline at end of file + return ( + + + + {children} + + + + + ) +} \ No newline at end of file