Overview
Reportr implements a complete atomic design system for building consistent, reusable, and scalable UI components. The architecture follows Brad Frost’s atomic design methodology, organizing components from smallest to largest: Atoms → Molecules → Organisms → Templates → Pages. Location:src/components/
Design Hierarchy
Atoms
Location:src/components/atoms/
Basic building blocks - the smallest functional components that can’t be broken down further.
Available Atoms
- Button - Primary UI interaction component
- Input - Text input fields
- Textarea - Multi-line text input
- Select - Dropdown selection
- Checkbox - Boolean toggle input
- Radio - Single selection from options
- Switch - Toggle switch component
- Typography - Text styling (H1-H6, body, caption)
- Icon - Icon wrapper component
- Card - Container with elevation
- Link - Styled anchor elements
- Logo - Brand logo component
- Divider - Visual separator
- Spinner - Loading indicator
- Skeleton - Loading placeholder
- Progress - Progress bar
- Tooltip - Hover information
- Container - Layout wrapper
- Flex - Flexbox layout
- Grid - Grid layout
- Spacer - Spacing utility
Example: Button Atom
File:src/components/atoms/Button.tsx
- 7 variants (primary, secondary, outline, ghost, success, warning, error)
- 5 sizes (xs, sm, md, lg, xl)
- Loading state with spinner
- Full TypeScript typing
- Forwarded refs for form integration
- Accessibility built-in
Molecules
Location:src/components/molecules/
Simple combinations of atoms creating functional units.
Available Molecules
- MetricCard - Display metric with change indicator
- UserMenu - User profile dropdown
- FormField - Input with label and error
- SearchBox - Search input with icon
- StatusBadge - Colored status indicator
- EmptyState - No data placeholder
- LoadingCard - Card loading state
- DropdownMenu - Dropdown menu component
- ButtonGroup - Grouped button actions
- TabGroup - Tab navigation
- ThemeSelector - Color picker
- PasswordInput - Password field with toggle
- TrialCountdown - Trial expiry countdown
- UsageCard - Usage statistics display
- UsageProgressBar - Usage limit visualization
- BillingCard - Subscription details
- PaymentHistory - Payment transaction list
- EmailVerificationBanner - Email verification prompt
- PayPalSubscribeButton - Subscription button
Example: MetricCard Molecule
File:src/components/molecules/MetricCard.tsx
- Card atom (container)
- Typography atom (text)
- Icon atom (visual indicators)
- Custom logic for change calculation
Organisms
Location:src/components/organisms/
Complex components composed of molecules and atoms.
Available Organisms
- DashboardSidebar - Main navigation sidebar
- DashboardMobileHeader - Mobile navigation
- NavigationBar - Top navigation bar
- UserMenu - User account dropdown
- StatsOverview - Dashboard statistics panel
- RecentActivity - Activity feed
- BrandingPreview - White-label preview
- Modal - Modal dialog system
- ManageClientModal - Client CRUD modal
- PropertyManagementModal - Google property selector
- MetricSelectorModal - Custom metrics selector
- UpgradeModal - Subscription upgrade prompt
- UpgradePromptModal - Usage limit upgrade prompt
- AddCustomMetricModal - Custom metric creator
Example: DashboardSidebar Organism
File:src/components/organisms/DashboardSidebar.tsx
- Multiple atoms (Button, Skeleton, etc.)
- UserMenu organism
- Navigation logic
- White-label branding
- Responsive design
Templates
Location:src/components/templates/
Page layouts and structural patterns.
Available Templates
- DashboardLayout - Main dashboard layout with sidebar
- AuthTemplate - Authentication page layout
- ShowcaseTemplate - Landing/marketing layout
Example: DashboardLayout Template
Pages
Location:src/components/pages/ and src/app/
Complete page implementations using templates.
White-Label Theming
CSS Custom Properties
Reportr uses CSS variables for dynamic white-label branding. File:src/app/globals.css
Dynamic Theming
User-specific colors applied at runtime:Tailwind Configuration
File:tailwind.config.js
Component Patterns
1. Composition over Props
2. TypeScript Props Interface
3. Forwarded Refs
4. Compound Components
Utility Functions
File:src/lib/utils.ts
Best Practices
- Single Responsibility - Each component does one thing well
- Reusability - Design for multiple use cases
- Accessibility - ARIA labels, keyboard navigation, focus states
- Performance - React.memo for expensive components
- TypeScript - Full type coverage for props and events
- Testing - Unit tests for complex logic
- Documentation - JSDoc comments for exported components
Component Checklist
When creating a new component:- TypeScript interface for props
- Forwarded ref if DOM element
- Accessibility attributes (ARIA)
- Loading/disabled states
- Responsive design (mobile-first)
- Dark mode support (if applicable)
- White-label theming support
- Error states and validation
- JSDoc documentation
- Example usage in comments