Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion frontend/src/components/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Logo } from "@/components/common/Logo";
import { ToastContainer } from "@/components/notifications/Toast";
import { SkipLink } from "@/components/ui/SkipLink";
import { BottomNav } from "@/components/ui/BottomNav";
import { PageTransition } from "@/components/layout/PageTransition";
import Link from "next/link";

interface AppLayoutProps {
Expand All @@ -21,7 +22,9 @@ export function AppLayout({ children }: AppLayoutProps) {
<MobileHeaderActions />
</div>
</header>
<main id="main-content" className="container py-6 md:py-10 flex-1 pb-20 md:pb-10" role="main">{children}</main>
<main id="main-content" className="container py-6 md:py-10 flex-1 pb-20 md:pb-10" role="main">
<PageTransition>{children}</PageTransition>
</main>
<ToastContainer />
<BottomNav />
<footer className="border-t py-8 md:py-10" role="contentinfo">
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/components/layout/PageTransition.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client'

import { AnimatePresence, motion, useReducedMotion } from 'framer-motion'
import { usePathname } from 'next/navigation'

interface PageTransitionProps {
children: React.ReactNode
}

export function PageTransition({ children }: PageTransitionProps) {
const pathname = usePathname()
const shouldReduceMotion = useReducedMotion()

if (shouldReduceMotion) {
return <>{children}</>
}

return (
<AnimatePresence mode="wait" initial={false}>
<motion.div
key={pathname}
initial={{ opacity: 0, y: 6 }}
animate={{ opacity: 1, y: 0, transition: { duration: 0.12, ease: 'easeOut' } }}
exit={{ opacity: 0, transition: { duration: 0.08, ease: 'easeIn' } }}
>
{children}
</motion.div>
</AnimatePresence>
)
}