From 0de822c2a18ed548e328acdcc09cc917bfb97b6c Mon Sep 17 00:00:00 2001 From: Desktop Date: Fri, 14 Nov 2025 15:09:32 +0500 Subject: [PATCH] phase 4 --- frontend/DESIGN_SYSTEM.md | 62 +++++++- frontend/MIGRATION_GUIDE.md | 216 +++++++++++++++++++++++++++ frontend/src/styles/README.md | 89 +++++------ frontend/src/styles/igny8-colors.css | 33 ++-- 4 files changed, 340 insertions(+), 60 deletions(-) create mode 100644 frontend/MIGRATION_GUIDE.md diff --git a/frontend/DESIGN_SYSTEM.md b/frontend/DESIGN_SYSTEM.md index 4689087c..dcb56507 100644 --- a/frontend/DESIGN_SYSTEM.md +++ b/frontend/DESIGN_SYSTEM.md @@ -2,24 +2,64 @@ > 🔒 **STYLE SYSTEM LOCKED** - This design system is **LOCKED** as of 2025-01-XX. Read this entire document before making any styling changes. +## 🎨 Design Token System + +**Single Source of Truth**: All design tokens (colors, gradients, shadows) are defined in `/src/styles/tokens.css` + +### Color Tokens + +Use CSS variables for colors: +- `var(--color-primary)` - Primary brand blue (#0693e3) +- `var(--color-primary-dark)` - Primary dark (#0472b8) +- `var(--color-success)` - Success green (#0bbf87) +- `var(--color-warning)` - Warning amber (#ff7a00) +- `var(--color-danger)` - Danger red (#ef4444) +- `var(--color-purple)` - Purple accent (#5d4ae3) + +### Using Colors + +**✅ DO:** +```tsx +// Use Tailwind utilities with brand colors +
Content
+ +// Use CSS variables for custom values +
Content
+ +// Use React components + +``` + +**❌ DON'T:** +```tsx +// Don't use deprecated .igny8-* utility classes +
Content
+ +// Don't hardcode color values +
Content
+ +// Don't use inline styles +
Content
+``` + ## 🔒 Style System Lock Status **DO NOT:** - ❌ Create new CSS classes without documenting in this file - ❌ Duplicate existing styling patterns - ❌ Create custom colors/utilities that already exist -- ❌ Modify core classes (`.igny8-table-compact`, etc.) without updating documentation +- ❌ Use deprecated `.igny8-*` utility classes (except `.igny8-table-*` and `.igny8-header-metric-*`) - ❌ Add inline styles for colors/spacing/typography +- ❌ Hardcode color hex values **DO:** - ✅ Check this document before creating any styles -- ✅ Use existing classes from `igny8-colors.css` -- ✅ Use Tailwind defaults where possible +- ✅ Use design tokens from `tokens.css` via CSS variables +- ✅ Use Tailwind utilities (bg-brand-500, text-brand-500, etc.) +- ✅ Use React components (Button, Badge, Card) from `/components/ui/` - ✅ Follow component patterns from this guide - ✅ Update this document if you MUST add something new -Any new styling that duplicates existing functionality or creates new classes without documentation will be considered technical debt. - --- ## Core Principles @@ -76,11 +116,21 @@ Any new styling that duplicates existing functionality or creates new classes wi ### 5. **Styling Guidelines** - Use Tailwind CSS classes exclusively -- Follow the existing color scheme from `igny8-colors.css` +- Use design tokens from `tokens.css` via CSS variables: `var(--color-primary)` +- Use Tailwind brand color utilities: `bg-brand-500`, `text-brand-500`, etc. +- Use React components for buttons, badges, cards (Button, Badge, Card) - Use dark mode variants: `dark:bg-gray-900`, `dark:text-white`, etc. - Maintain consistent spacing using Tailwind spacing scale - Use existing utility classes: `shadow-theme-xs`, `text-theme-sm`, etc. +### 5a. **Deprecated Patterns (DO NOT USE)** +- ❌ `.igny8-bg-*`, `.igny8-text-*`, `.igny8-border-*` utility classes +- ❌ `var(--igny8-blue)` - use `var(--color-primary)` instead +- ❌ Hardcoded hex colors like `#0693e3` +- ❌ Inline `style={{ color: ... }}` attributes + +**Exception**: `.igny8-table-*` and `.igny8-header-metric-*` classes are still active and should be used for table/header components. + ### 6. **When Creating New Components is Acceptable** Only create new components if: 1. Explicitly requested by the user diff --git a/frontend/MIGRATION_GUIDE.md b/frontend/MIGRATION_GUIDE.md new file mode 100644 index 00000000..0722b10d --- /dev/null +++ b/frontend/MIGRATION_GUIDE.md @@ -0,0 +1,216 @@ +# CSS Migration Guide + +This guide documents the migration from legacy `.igny8-*` classes and `--igny8-*` variables to the new standardized design token system. + +## Overview + +All design tokens are now centralized in `/src/styles/tokens.css` with plain naming (no "igny8" prefix). The legacy `igny8-colors.css` file is maintained for backward compatibility but should not be used in new code. + +## Color Token Migration + +### CSS Variables + +**Before:** +```tsx +
Content
+``` + +**After:** +```tsx +
Content
+``` + +### Complete Variable Mapping + +| Legacy Variable | New Token | Usage | +|----------------|-----------|-------| +| `--igny8-blue` | `--color-primary` | Primary brand color | +| `--igny8-blue-dark` | `--color-primary-dark` | Primary dark variant | +| `--igny8-green` | `--color-success` | Success states | +| `--igny8-green-dark` | `--color-success-dark` | Success dark variant | +| `--igny8-amber` | `--color-warning` | Warning states | +| `--igny8-amber-dark` | `--color-warning-dark` | Warning dark variant | +| `--igny8-red` | `--color-danger` | Danger/error states | +| `--igny8-red-dark` | `--color-danger-dark` | Danger dark variant | +| `--igny8-purple` | `--color-purple` | Purple accent | +| `--igny8-purple-dark` | `--color-purple-dark` | Purple dark variant | + +## Utility Class Migration + +### Background Colors + +**Before:** +```tsx +
Content
+``` + +**After (Option 1 - Tailwind):** +```tsx +
Content
+``` + +**After (Option 2 - CSS Variable):** +```tsx +
Content
+``` + +### Text Colors + +**Before:** +```tsx +Text +``` + +**After (Option 1 - Tailwind):** +```tsx +Text +``` + +**After (Option 2 - CSS Variable):** +```tsx +Text +``` + +### Border Colors + +**Before:** +```tsx +
Content
+``` + +**After (Option 1 - Tailwind):** +```tsx +
Content
+``` + +**After (Option 2 - CSS Variable):** +```tsx +
Content
+``` + +## Component Migration + +### Buttons + +**Before:** +```tsx + + Click me + +``` + +**After:** +```tsx +import Button from '@/components/ui/button/Button'; + + +``` + +### Badges + +**Before:** +```tsx +New +``` + +**After:** +```tsx +import Badge from '@/components/ui/badge/Badge'; + +New +``` + +### Cards + +**Before:** +```tsx +
+
Title
+ Content +
+``` + +**After:** +```tsx +import { Card, CardTitle, CardContent } from '@/components/ui/card/Card'; + + + Title + Content + +``` + +## Gradients + +**Before:** +```tsx +
+ Content +
+``` + +**After:** +```tsx +
+ Content +
+``` + +Or use the Button component with `variant="gradient"`: +```tsx + +``` + +## Active Classes (Still in Use) + +These classes are still actively used and should continue to be used: + +- `.igny8-table-container` - Table wrapper with loading states +- `.igny8-table-wrapper` - Table scroll wrapper +- `.igny8-table-compact` - Compact table styling +- `.igny8-table-smooth` - Smooth table transitions +- `.igny8-table-body` - Table body styling +- `.igny8-skeleton-row` - Loading skeleton rows +- `.igny8-header-metrics` - Header metrics container +- `.igny8-header-metric` - Individual metric +- `.igny8-header-metric-accent` - Metric accent color +- `.igny8-header-metric-label` - Metric label +- `.igny8-header-metric-value` - Metric value +- `.igny8-header-metric-separator` - Metric separator + +## Migration Checklist + +When updating a file: + +- [ ] Replace `--igny8-*` variables with `--color-*` tokens +- [ ] Replace `.igny8-bg-*` with `bg-brand-500` or `bg-[var(--color-primary)]` +- [ ] Replace `.igny8-text-*` with `text-brand-500` or `text-[var(--color-primary)]` +- [ ] Replace `.igny8-border-*` with `border-brand-500` or `border-[var(--color-primary)]` +- [ ] Replace hardcoded buttons with ` ``` -## Color Variables +**❌ DON'T:** +```tsx +// Don't use deprecated utility classes +
Content
-All colors are available as CSS variables: -- `--igny8-blue` - Primary brand blue -- `--igny8-green` - Success green -- `--igny8-amber` - Warning amber -- `--igny8-red` - Danger red -- `--igny8-purple` - Purple accent -- `--igny8-surface` - Page background -- `--igny8-panel` - Card background -- `--igny8-text` - Primary text -- `--igny8-stroke` - Borders +// Don't hardcode colors +
Content
+``` -## Utility Classes +## Legacy File (`igny8-colors.css`) -All utility classes use `igny8-` prefix: -- Backgrounds: `.igny8-bg-blue`, `.igny8-bg-green`, etc. -- Text: `.igny8-text-blue`, `.igny8-text-primary`, etc. -- Borders: `.igny8-border-blue`, `.igny8-border-stroke`, etc. -- Gradients: `.igny8-gradient-blue`, `.igny8-gradient-success`, etc. -- Buttons: `.igny8-btn`, `.igny8-btn-primary`, etc. -- Badges: `.igny8-badge`, `.igny8-badge-primary`, etc. +⚠️ **DEPRECATED** - This file is maintained for backward compatibility only. -## Benefits +- Legacy variable aliases (`--igny8-*` → `--color-*`) +- Active utility classes (`.igny8-table-*`, `.igny8-header-metric-*`) +- Deprecated utility classes (marked - do not use in new code) -✅ **No conflicts** - Separate prefix prevents TailAdmin update issues -✅ **Easy updates** - TailAdmin can be updated without affecting IGNY8 styles -✅ **Clear separation** - Easy to identify IGNY8 vs TailAdmin styles -✅ **Consistent branding** - All IGNY8 components use same color scheme +See `MIGRATION_GUIDE.md` for migration instructions. + +## Migration + +All new code should use: +1. Design tokens from `tokens.css` +2. Tailwind utilities (`bg-brand-500`, `text-brand-500`) +3. React components (`Button`, `Badge`, `Card`) + +See `../MIGRATION_GUIDE.md` for complete migration guide. diff --git a/frontend/src/styles/igny8-colors.css b/frontend/src/styles/igny8-colors.css index c47c92cd..33fcad5b 100644 --- a/frontend/src/styles/igny8-colors.css +++ b/frontend/src/styles/igny8-colors.css @@ -1,22 +1,26 @@ /* =================================================================== - IGNY8 CUSTOM COLOR SCHEME + IGNY8 UTILITY CLASSES & LEGACY SUPPORT =================================================================== - This file contains IGNY8 brand colors from WordPress plugin. - All classes use 'igny8-' prefix to avoid conflicts with TailAdmin defaults. - Import this file separately to keep TailAdmin updates from affecting it. + ⚠️ DEPRECATED: This file is maintained for backward compatibility. + New code should use: + - CSS variables: var(--color-primary), var(--color-success), etc. + - Tailwind utilities: bg-brand-500, text-brand-500, etc. + - React components: Button, Badge, Card from /components/ui/ 🔒 DESIGN SYSTEM LOCKED - See DESIGN_SYSTEM.md for complete style guide - IMPORTANT: Before adding new CSS classes, check DESIGN_SYSTEM.md to ensure - you're not duplicating existing functionality. All visual styling patterns - are documented and locked. + This file provides: + 1. Legacy variable aliases (--igny8-* → --color-*) + 2. Active utility classes (.igny8-table-*, .igny8-header-metric-*) + 3. Deprecated utility classes (marked below - do not use in new code) =================================================================== */ /* === CSS CUSTOM PROPERTIES (Variables) === */ /* Import tokens from centralized tokens.css */ @import "./tokens.css"; -/* Legacy variable aliases for backward compatibility during migration */ +/* Legacy variable aliases for backward compatibility */ +/* These allow old code using --igny8-* to continue working */ :root { --igny8-blue: var(--color-primary); --igny8-blue-dark: var(--color-primary-dark); @@ -47,13 +51,18 @@ } /* =================================================================== - IGNY8 UTILITY CLASSES + DEPRECATED UTILITY CLASSES =================================================================== - Use these classes instead of Tailwind defaults for IGNY8 branding. - Example: Use 'igny8-bg-blue' instead of 'bg-brand-500' + ⚠️ DO NOT USE IN NEW CODE + These classes are deprecated. Use Tailwind utilities or React components instead: + - .igny8-bg-blue → bg-brand-500 or bg-[var(--color-primary)] + - .igny8-text-blue → text-brand-500 or text-[var(--color-primary)] + - .igny8-border-blue → border-brand-500 or border-[var(--color-primary)] + + Migration: Replace with Tailwind utilities or use Button/Badge/Card components. =================================================================== */ -/* === Background Colors === */ +/* === Background Colors (DEPRECATED) === */ .igny8-bg-blue { background-color: var(--igny8-blue); } .igny8-bg-blue-dark { background-color: var(--igny8-blue-dark); } .igny8-bg-green { background-color: var(--igny8-green); }