# IGNY8 Design Standard Reference **Standardized UI patterns used across Planner, Writer, and Dashboard modules** This document defines the locked design patterns and component usage standards for the IGNY8 application. All modules (including Sites) should follow these patterns to maintain visual consistency. --- ## Core Component Library ### 1. Button Component **Location:** `frontend/src/components/ui/button/Button.tsx` **Status:** 🔒 STYLE LOCKED - See `DESIGN_SYSTEM.md` #### Variants (5 total) - `solid` - Filled background (primary action) - `soft` - Light background (secondary action) - `outline` - Border only (tertiary action) - `ghost` - No border or background (minimal action) - `gradient` - Gradient background with shadow (premium/highlight action) #### Sizes (4 total) - `xs` - Extra small - `sm` - Small - `md` - Medium (default) - `lg` - Large #### Tones (5 total) - `brand` - Primary brand color (blue) - `success` - Green - `warning` - Orange - `danger` - Red/Error - `neutral` - Gray #### Usage Example ```tsx import Button from '../../components/ui/button/Button'; ``` #### ⚠️ Anti-Pattern ```tsx // ❌ DON'T: Raw HTML buttons with inline Tailwind // ✅ DO: Use Button component ``` --- ### 2. ComponentCard **Location:** `frontend/src/components/common/ComponentCard.tsx` **Purpose:** Standard card wrapper for sections with title and description #### Props - `title` (required) - Section title (string or ReactNode) - `desc` (optional) - Description text below title - `children` (required) - Card content - `className` (optional) - Additional styling #### Usage Example ```tsx import ComponentCard from '../../components/common/ComponentCard';
{/* Content */}
``` #### Structure - **Header:** Title + optional description (gray text) - **Body:** Border-top separated content area with padding - **Dark mode:** Automatic theme support #### ⚠️ Anti-Pattern ```tsx // ❌ DON'T: Raw Card component with manual header

Quick Actions

{/* Content */}
// ✅ DO: Use ComponentCard {/* Content */} ``` --- ### 3. EnhancedMetricCard **Location:** `frontend/src/components/dashboard/EnhancedMetricCard.tsx` **Purpose:** Display metrics with optional trends, tooltips, and navigation #### Key Props - `title` (required) - Metric label - `value` (required) - Main metric value (string | number) - `subtitle` (optional) - Additional context below value - `icon` (optional) - Icon component - `accentColor` (required) - Border accent color - `trend` (optional) - { direction: 'up' | 'down', value: string } - `href` (optional) - React Router navigation path - `onClick` (optional) - Click handler (alternative to href) - `tooltip` (optional) - Tooltip text on hover - `details` (optional) - Array of tooltip detail breakdowns #### Accent Colors (6 total) - `blue` - Primary/default metrics - `green` - Success/positive metrics - `orange` - Warning/attention metrics - `purple` - Special/premium metrics - `red` - Error/critical metrics - `success` - Alternative green (var(--color-success)) #### Usage Example ```tsx import EnhancedMetricCard from '../../components/dashboard/EnhancedMetricCard'; } accentColor="blue" trend={{ direction: 'up', value: '+12%' }} href="/planner/keywords" tooltip="View all active keywords" details={[ { label: 'Tracked', value: '800' }, { label: 'Untracked', value: '434' }, ]} /> ``` #### Features - Automatic Link wrapping when `href` provided - Hover effects and transitions - Dark mode support - Tooltip with optional details breakdown - Trend indicators with arrows #### ⚠️ Anti-Pattern ```tsx // ❌ DON'T: Custom metric cards with inline styles

Active Keywords

1,234

// ✅ DO: Use EnhancedMetricCard } accentColor="blue" /> ``` --- ### 4. PageHeader **Location:** `frontend/src/components/common/PageHeader.tsx` **Purpose:** Standardized page header with title, site/sector info, and selectors #### Key Props - `title` (required) - Page title - `lastUpdated` (optional) - Last refresh timestamp - `badge` (optional) - { icon: ReactNode, color: 'blue' | 'green' | ... } - `showRefresh` (optional) - Show refresh button - `onRefresh` (optional) - Refresh button handler - `hideSiteSector` (optional) - Hide site/sector info for global pages - `className` (optional) - Additional styling #### Badge Colors (6 total) Same as Button/Metric: `blue`, `green`, `purple`, `orange`, `red`, `indigo` #### Usage Example ```tsx import PageHeader from '../../components/common/PageHeader'; import { ListIcon } from '../../icons'; , color: 'blue' }} showRefresh={true} onRefresh={handleRefresh} /> ``` #### Features - Automatic site/sector display from stores - SiteAndSectorSelector integration - Responsive layout (stack on mobile) - Badge with icon support - Last updated timestamp #### ⚠️ Anti-Pattern ```tsx // ❌ DON'T: Custom page headers with manual layout

Keyword Dashboard

Site: {site.name} • Sector: {sector.name}

// ✅ DO: Use PageHeader ``` --- ### 5. Link Component (React Router) **Location:** `react-router-dom` **Purpose:** Standard navigation with automatic prefetching and accessibility #### Usage Example ```tsx import { Link } from 'react-router-dom';
Navigate to Keywords
``` #### Benefits Over Button + Navigate - ✅ Proper semantic HTML (`` tag) - ✅ Keyboard navigation (Tab + Enter) - ✅ Right-click "Open in new tab" support - ✅ Screen reader accessibility - ✅ Browser history support - ✅ Automatic prefetching #### ⚠️ Anti-Pattern ```tsx // ❌ DON'T: Button with onClick navigate // ✅ DO: Use Link component Go to Keywords ``` --- ## Design Patterns ### Quick Actions Grid **Standard pattern used in:** Planner Dashboard, Writer Dashboard #### Structure ```tsx
{/* Gradient Icon */}
{/* Content */}

Action Title

Action description

{/* Arrow Icon */}
``` #### Key Elements 1. **ComponentCard wrapper** - Title + description 2. **Responsive grid** - 1 col mobile, 2 col tablet, 4 col desktop 3. **Link component** - Not button 4. **Gradient icon box** - 48px (size-12), gradient from primary to primary-dark 5. **Content area** - Title (font-semibold) + description (text-sm) 6. **Arrow icon** - Right-pointing, changes color on hover 7. **Hover effects** - Border color + shadow on hover #### Gradient Color Variants ```tsx // Primary (Blue) from-[var(--color-primary)] to-[var(--color-primary-dark)] // Success (Green) from-[var(--color-success)] to-[var(--color-success-dark)] // Warning (Orange) from-[var(--color-warning)] to-[var(--color-warning-dark)] // Purple from-[var(--color-purple)] to-[var(--color-purple-dark)] ``` #### ⚠️ Anti-Pattern - Sites Dashboard Current Implementation ```tsx // ❌ DON'T: Button with navigate + manual styling // ✅ DO: Link component {/* ... */} ``` --- ### Metrics Dashboard Grid **Standard pattern used in:** Planner Dashboard, Writer Dashboard #### Structure ```tsx
} accentColor="blue" href="/path" />
``` #### Grid Breakpoints - **Mobile (< 768px):** 1 column - **Tablet (768px - 1024px):** 2 columns - **Desktop (> 1024px):** 3 columns #### Best Practices - Use `href` prop for navigation (not `onClick`) - Consistent icon sizing: `h-5 w-5` - Map accent colors to metric meaning (blue = neutral, green = success, orange = warning, red = error) - Include tooltips for complex metrics - Add trend indicators when comparing periods --- ## Color System ### CSS Variables ```css --color-primary: #0693e3; /* Brand Blue */ --color-primary-dark: #0570b8; --color-success: #0bbf87; /* Green */ --color-success-dark: #089968; --color-warning: #ff7a00; /* Orange */ --color-warning-dark: #cc6200; --color-purple: #5d4ae3; --color-purple-dark: #4a3bb5; --color-error: #f44336; /* Red */ ``` ### Tailwind Color Classes - `brand-*` - Primary blue (50-900) - `success-*` - Green (50-900) - `warning-*` - Orange (50-900) - `error-*` - Red (50-900) - `purple-*` - Purple (50-900) - `gray-*` - Neutral (50-900) --- ## Sites Module Refactor Checklist ### Current Inconsistencies (Sites Dashboard Example) - ❌ Uses `