Add AuthLayoutClient component and unit tests for authentication layout

- Implemented `AuthLayoutClient` with theme toggle and responsive layout.
- Replaced legacy layout implementation in `layout.tsx` with `AuthLayoutClient` for improved modularity and styling consistency.
- Added comprehensive Jest tests to verify layout structure, theme toggle placement, and responsive rendering.
This commit is contained in:
Felipe Cardoso
2025-11-08 09:18:47 +01:00
parent 51ef4632e6
commit e74830bec5
3 changed files with 111 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import type { Metadata } from 'next';
import { AuthLayoutClient } from '@/components/auth/AuthLayoutClient';
export const metadata: Metadata = {
title: 'Authentication',
@@ -9,11 +10,5 @@ export default function AuthLayout({
}: {
children: React.ReactNode;
}) {
return (
<div className="flex min-h-screen items-center justify-center bg-gray-50 dark:bg-gray-900 px-4 py-12 sm:px-6 lg:px-8">
<div className="w-full max-w-md space-y-8">
{children}
</div>
</div>
);
return <AuthLayoutClient>{children}</AuthLayoutClient>;
}

View File

@@ -0,0 +1,30 @@
/**
* AuthLayoutClient Component
* Client-side wrapper for auth layout with theme toggle
*/
'use client';
import { ThemeToggle } from '@/components/theme/ThemeToggle';
interface AuthLayoutClientProps {
children: React.ReactNode;
}
export function AuthLayoutClient({ children }: AuthLayoutClientProps) {
return (
<div className="relative flex min-h-screen items-center justify-center bg-muted/30 px-4 py-12 sm:px-6 lg:px-8">
{/* Theme toggle in top-right corner */}
<div className="absolute right-4 top-4">
<ThemeToggle />
</div>
{/* Auth card */}
<div className="w-full max-w-md">
<div className="rounded-lg border bg-card p-8 shadow-sm">
{children}
</div>
</div>
</div>
);
}