veza/apps/web/src/features/auth/components/AuthLayout.tsx

88 lines
2.6 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { Link } from 'react-router-dom';
import { cn } from '@/lib/utils';
interface AuthLayoutProps {
title: string;
subtitle?: string;
children: React.ReactNode;
footerLinks?: Array<{ label: string; to: string }>;
className?: string;
}
export function AuthLayout({
title,
subtitle,
children,
footerLinks,
className,
}: AuthLayoutProps) {
return (
<div
className={cn(
'min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 py-12 px-4 sm:px-6 lg:px-8',
2025-12-13 02:34:34 +00:00
className,
)}
role="main"
aria-label="Page d'authentification"
>
<div className="max-w-md w-full space-y-8">
{/* Logo and Title */}
<header className="text-center">
<div className="flex items-center justify-center mb-4">
<div
className="h-10 w-10 rounded-lg bg-blue-600 dark:bg-blue-500 flex items-center justify-center"
aria-hidden="true"
>
<span className="text-white font-bold text-xl">V</span>
</div>
<span className="ml-2 font-bold text-2xl text-gray-900 dark:text-white">
Veza
</span>
</div>
2025-12-13 02:34:34 +00:00
<h1
id="auth-form-title"
className="text-3xl font-bold text-gray-900 dark:text-white"
>
{title}
</h1>
{subtitle && (
2025-12-13 02:34:34 +00:00
<p
className="mt-2 text-sm text-gray-600 dark:text-gray-400"
role="doc-subtitle"
>
{subtitle}
</p>
)}
</header>
{/* Content Card */}
2025-12-13 02:34:34 +00:00
<section
className="bg-white dark:bg-gray-800 py-8 px-6 shadow-lg rounded-lg border border-gray-200 dark:border-gray-700"
aria-labelledby="auth-form-title"
>
{children}
</section>
{/* Footer Links */}
{footerLinks && footerLinks.length > 0 && (
2025-12-13 02:34:34 +00:00
<nav
className="text-center space-x-4"
aria-label="Navigation d'authentification"
>
{footerLinks.map((link) => (
<Link
key={link.to}
to={link.to}
className="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 rounded"
>
{link.label}
</Link>
))}
</nav>
)}
</div>
</div>
);
}