Component Architecture
The Horse Trust frontend uses a modular component architecture organized by feature and function. Components are located in the/component directory and are built with React, TypeScript, and Tailwind CSS.
Component Directory Structure
Layout Components
Header
The main navigation header with authentication state management. Location:component/layout/Header.tsx
Type: Client Component ("use client")
Interface
Key Features
- Responsive navigation with mobile menu
- User authentication state display
- Dynamic navigation links based on login status
- User dropdown menu with avatar
- Sticky positioning with backdrop blur
Usage Example
Code Snippet
component/layout/Header.tsx
Footer
Site-wide footer with navigation links and branding. Location:component/layout/Footer.tsx
Type: Server Component
Features
- Multi-column link organization
- Social media links
- Copyright information
- Responsive grid layout
Code Example
component/layout/Footer.tsx
Home Components
HeroSection
The landing page hero with search functionality. Location:component/home/HeroSection.tsx
Type: Server Component
Features
- Full-width hero with background image
- Search inputs for breed and discipline
- Gradient overlay for text readability
- Call-to-action button
component/home/HeroSection.tsx
FeaturedHorses
Displays featured horses fetched from the API. Location:component/home/FeaturedHorses.tsx
Type: Async Server Component
Features
- Server-side data fetching
- Error handling for API failures
- Responsive grid layout
- Verified badge display
component/home/FeaturedHorses.tsx
SecuritySection
Highlights platform security features. Location:component/home/SecuritySection.tsx
Type: Server Component
Features
- Two-column layout with image and text
- Icon-based feature highlights
- Statistics display
- Call-to-action section
component/home/SecuritySection.tsx
Marketplace Components
HorseCard
Individual horse listing card. Location:component/marketplace/HorseCard.tsx
Type: Server Component
Interface
Full Implementation
component/marketplace/HorseCard.tsx
FilterSideBar
Sidebar with filtering options for marketplace. Location:component/marketplace/FilterSideBar.tsx
Type: Client Component
Interface
Implementation
component/marketplace/FilterSideBar.tsx
Component Best Practices
Server vs Client Components
- Use Server Components by default for better performance
- Add
"use client"only when needed (interactivity, state, effects) - Server Components can fetch data directly
TypeScript Interfaces
Define clear interfaces for all component props:Styling Conventions
- Use Tailwind utility classes
- Leverage custom color variables from theme
- Apply responsive design with Tailwind breakpoints
Icon Usage
Import icons fromlucide-react:
Reusability Guidelines
- Extract common UI patterns into reusable components
- Use composition over inheritance
- Keep components focused on a single responsibility
- Pass data through props, not global state
- Co-locate styles with components using Tailwind

