Authentication Components
The authentication module provides three core components for building login and registration flows with a consistent UI/UX.Components Overview
LoginForm
Complete login form with email/password and OAuth
RegisterForm
User registration form with validation
AuthHero
Branded hero section for auth screens
LoginForm
A fully-featured login form component with email/password authentication, OAuth support, and remember me functionality.Usage
modules/auth/screens/LoginScreen.tsx
Features
- Email/Password Authentication: Validated input fields with error handling
- OAuth Integration: Google sign-in button (ready for implementation)
- Password Visibility Toggle: Eye icon to show/hide password
- Remember Me Checkbox: Session persistence option
- Loading States: Disabled state with “Ingresando…” text during submission
- Error Display: API error messages shown below form
- Forgot Password Link: Navigation to password recovery
Component Structure
The component is self-contained with its own state management:Integration
Uses theuseLogin hook from /modules/auth/hooks/useLogin.ts:9 for authentication logic:
Dependencies
@/components/ui/button- shadcn/ui Button component@/components/ui/input- shadcn/ui Input component@/components/ui/label- shadcn/ui Label component@/components/ui/checkbox- shadcn/ui Checkbox componentlucide-react- EyeIcon, EyeOffIconuseLogin- Custom authentication hook
RegisterForm
User registration form with first name, last name, email, password fields and terms acceptance.Usage
modules/auth/screens/RegisterScreen.tsx
Features
- Multi-field Form: First name, last name, email, and password inputs
- OAuth Alternative: Google registration button
- Terms & Conditions: Checkbox with links to terms and privacy policy
- Form Validation: Required fields with HTML5 validation
- Responsive Layout: Two-column grid for name fields on larger screens
Form Fields
User’s first name (e.g., “Juan”)
User’s last name (e.g., “Pérez”)
User’s email address (e.g., “[email protected]”)
Password with minimum 8 characters
Accept terms of service and privacy policy
Styling
The form uses consistent styling with the login form:- Input height:
h-12(48px) - Button styling:
bg-[#2563eb]with bold text - Maximum width:
max-w-[450px] - Spacing:
space-y-8for sections,space-y-5for form fields
AuthHero
Branded hero component displayed on the left side of authentication screens, featuring the RespondeIA logo, customizable title, subtitle, and feature list.Props
Main heading - can include JSX for styling (e.g., colored spans, line breaks)
Descriptive text shown below the title in muted color
Array of feature strings displayed as a checklist
Usage Example
modules/auth/screens/LoginScreen.tsx
Visual Design
- Background: Dark navy
bg-[#0b1222] - Logo: “Responde” + blue “IA” in top left
- Title: Large (4xl-6xl) white text with optional colored spans
- Subtitle: White with 55% opacity
- Features: Checklist with CheckCircle2 icons and white/55 text
Typography Scale
- Logo:
text-xl font-bold - Title:
text-4xl md:text-5xl lg:text-6xl font-bold - Subtitle:
text-lg text-white/55 - Features:
text-base md:text-lg font-medium
Layout
Complete Integration Example
Best Practices
Responsive Layout
Responsive Layout
Always wrap auth components in a two-column layout: hero (left) and form (right). Hide the hero on mobile with
hidden lg:flex.Error Handling
Error Handling
The LoginForm displays errors automatically via the
useLogin hook. Ensure your API returns meaningful error messages.OAuth Integration
OAuth Integration
Both forms include Google OAuth buttons. Implement the OAuth flow by adding onClick handlers to the Google buttons.
Custom Styling
Custom Styling
All components use Tailwind CSS. Override styles by passing additional className props to wrapped UI components.
Related Documentation
useLogin Hook
Authentication hook used by LoginForm
Auth Store
Zustand store for auth state management
shadcn/ui Components
UI component library reference
Auth Service
API service for authentication endpoints
