Overview
The frontend uses a component-based architecture built with React and TypeScript. Components are organized by functionality and follow consistent patterns for props, state management, and styling.Component Structure
Components are located insrc/components/ and follow these conventions:
- TypeScript with typed props interfaces
- Functional components with hooks
- Lucide React for icons
- Tailwind CSS with custom design system
- React Router for navigation
Core Components
Layout Component
The main layout wrapper that provides navigation, header, and footer. Location:src/components/Layout.tsx
Props:
- Dynamic color scheme based on content type (series/movies/anime)
- Mobile-responsive navigation with hamburger menu
- Update notification system with version checking
- Persistent state using localStorage
- Series: Electric Sky (
text-electric-sky) - Movies: Fuchsia Pink (
text-fuchsia-pink) - Anime: Magenta Pink (
text-magenta-pink)
CatalogGrid Component
Displays content items in a responsive grid layout. Location:src/components/CatalogGrid.tsx
Props:
- Responsive grid (2-6 columns based on screen size)
- Loading skeleton states
- Type badges (Serie/Película/Anime)
- Hover effects with play icon overlay
- Lazy loading for images (except first item)
- Dynamic routing based on content type
FilterBar Component
Provides search and section filtering functionality. Location:src/components/FilterBar.tsx
Props:
- Search input with 400ms debounce
- Section dropdown using API data
- Optional deep search button
- Accessible labels and keyboard navigation
Pagination Component
Handles page navigation for catalog listings. Location:src/components/Pagination.tsx
Props:
- Smart page number display (max 5 visible)
- Previous/Next navigation
- Disabled state during loading
- Responsive text labels
LoadingSpinner Component
Reusable loading indicator. Location:src/components/LoadingSpinner.tsx
Props:
sm: 4x4 (h-4 w-4)md: 8x8 (h-8 w-8) - defaultlg: 12x12 (h-12 w-12)
ErrorBoundary Component
Class component for catching and handling React errors. Location:src/components/ErrorBoundary.tsx
Props:
- Catches errors in component tree
- Displays user-friendly error message
- Reload page functionality
- Console error logging
Component Patterns
Typed Props
All components use TypeScript interfaces for props:Conditional Styling
Components use template literals for dynamic classes:Icon Usage
Icons from Lucide React are imported and used as components:Accessibility
Components follow accessibility best practices:Design System
Colors
Primary Colors:text-neon-cyan- Primary accent colortext-electric-sky- Series colortext-fuchsia-pink- Movies colortext-magenta-pink- Anime color
bg-space-black- Main backgroundbg-dark-gray- Component backgroundsbg-gray-light- Light text
Glow Effects
Custom text glow classes:text-glow-cyantext-glow-electric-skytext-glow-fuchsia-pinktext-glow-magenta-pink
Typography
Fonts:font-orbitron- Headers and buttonsfont-roboto- Body text
Best Practices
- Component Reusability: Extract common patterns into reusable components
- Type Safety: Always define TypeScript interfaces for props
- Performance: Use lazy loading for images (except above-the-fold content)
- Responsive Design: Test components at all breakpoints
- Accessibility: Include ARIA labels and semantic HTML
- Error Handling: Wrap async operations in try-catch blocks
- Loading States: Provide skeleton screens or spinners during data fetching
Testing Components
When creating new components:- Define clear prop interfaces
- Handle loading and error states
- Test responsive behavior
- Verify accessibility with screen readers
- Check keyboard navigation
- Test with different data scenarios