puffin-app/components/RootLayoutClient.tsx

28 lines
811 B
TypeScript
Raw Normal View History

'use client';
import { usePathname } from 'next/navigation';
import { Header } from './Header';
import { Footer } from './Footer';
export function RootLayoutClient({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
const isAdminRoute = pathname?.startsWith('/admin');
const isCheckoutSuccess = pathname?.startsWith('/checkout/success');
if (isAdminRoute || isCheckoutSuccess) {
// Admin routes and checkout success render without header/footer
return <>{children}</>;
}
// Regular routes render with header/footer
return (
<>
<Header />
<main className="flex-1 max-w-[1600px] w-full mx-auto pb-8 sm:pb-12 px-4 sm:px-6 lg:px-8 overflow-hidden" style={{ paddingTop: '110px' }}>
{children}
</main>
<Footer />
</>
);
}