diff --git a/features/service-registry/COMPONENT_MIGRATION_DIFF.md b/features/service-registry/COMPONENT_MIGRATION_DIFF.md new file mode 100644 index 000000000..732a2f1fc --- /dev/null +++ b/features/service-registry/COMPONENT_MIGRATION_DIFF.md @@ -0,0 +1,508 @@ +# Service Registry → @ui Component Migration Analysis + +**Date**: 2025-12-28 +**Purpose**: Detailed comparison of service-registry custom components vs @ui equivalents + +--- + +## 1. StatCard vs MetricCard + +### Current Implementation (StatCard) +**Location**: `/codebase/features/service-registry/frontend/src/components/styles/Dashboard.styles.ts` + +**Props:** +```typescript +interface StatCardProps { + $variant?: 'default' | 'success' | 'error' | 'warning'; + $isActive?: boolean; + onClick?: () => void; + children: React.ReactNode; +} +``` + +**Key Features:** +- **Interactive button element** - Clickable for filtering +- **Active state styling** - Border color, background tint, box-shadow when `$isActive` +- **Hover effects** - Translate + shadow on hover (when not active) +- **Variant-based colors** - Maps variant to theme color (primary/success/error/warning) +- **Layout** - Flexbox column, children expected to be StatValue + StatLabel + StatSubtext + +**Usage Pattern:** +```tsx + toggleStatusFilter('healthy')} +> + 42 + Healthy + +``` + +--- + +### @ui Equivalent (MetricCard) +**Location**: `@transquinnftw/ui-analytics/src/MetricCard.tsx` + +**Props:** +```typescript +interface MetricCardProps { + label: string; + value: string | number; + change?: number; + trend?: 'up' | 'down' | 'neutral'; + format?: NumberFormat; + sparkline?: number[]; + icon?: React.ReactNode; + variant?: 'default' | 'primary' | 'success' | 'warning' | 'error'; +} +``` + +**Key Features:** +- **Static div element** - Not interactive by default +- **Border-left accent** - 4px left border for non-default variants +- **Change/trend display** - Built-in percentage change with arrows +- **Sparkline support** - Background sparkline visualization +- **Icon support** - Optional icon in header +- **Value formatting** - Built-in formatValue utility + +**Usage Pattern:** +```tsx + +``` + +--- + +### Key Differences + +| Aspect | StatCard (Current) | MetricCard (@ui) | Migration Impact | +|--------|-------------------|------------------|------------------| +| **Interactivity** | `