// Example: Authentication Layout with shadcn/ui // Demonstrates: Layout composition, card usage, form integration "use client" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { useState } from "react" export function AuthLayout() { const [isLoading, setIsLoading] = useState(false) async function onSubmit(event: React.FormEvent) { event.preventDefault() setIsLoading(true) // Simulate API call setTimeout(() => { setIsLoading(false) }, 2000) } return (
Login Register Login Enter your credentials to access your account.
Create an account Enter your information to create an account.
) } /** * Key Patterns Demonstrated: * * 1. Layout Composition: Centered authentication card with full-height viewport * 2. Card Usage: Structured content with header, body, and footer * 3. Tabs: Switch between login and register forms * 4. Form Structure: Proper labeling and input grouping * 5. Loading States: Button disabled state during form submission * 6. Responsive Design: Mobile-friendly with max-width constraint * 7. Tailwind Utilities: Using spacing, flexbox, and grid utilities * * Design Choices: * - Minimal, clean interface focusing on the task at hand * - Proper semantic HTML with form elements * - Accessible labels and inputs * - Clear visual hierarchy with card components * - Loading feedback for better UX * * Required Dependencies: * None beyond React and shadcn/ui components * * Installation: * npx shadcn@latest add card * npx shadcn@latest add input * npx shadcn@latest add label * npx shadcn@latest add button * npx shadcn@latest add tabs */