# Design System Migration Guide This guide helps migrate from the legacy frontend system to the unified design system. ## Overview The ThrillWiki frontend was consolidated from two parallel systems: - **Legacy System** (`/backend/templates/`, `/backend/static/css/`) - HSL-based variables, Font Awesome icons - **Modern System** (`/templates/`, `/static/css/`) - RGB hex-based design tokens, SVG icons The unified system uses `design-tokens.css` as the single source of truth. ## CSS Migration ### Color Variables Replace HSL-based variables with design tokens: ```css /* Before (legacy) */ background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); /* After (design tokens) */ background-color: var(--color-primary); color: var(--color-primary-foreground); ``` ### Common Replacements | Legacy | Design Token | |--------|--------------| | `hsl(var(--primary))` | `var(--color-primary)` | | `hsl(var(--secondary))` | `var(--color-secondary)` | | `hsl(var(--background))` | `var(--color-background)` | | `hsl(var(--foreground))` | `var(--color-foreground)` | | `hsl(var(--muted))` | `var(--color-muted)` | | `hsl(var(--accent))` | `var(--color-accent)` | | `hsl(var(--destructive))` | `var(--color-destructive)` | | `hsl(var(--border))` | `var(--color-border)` | | `hsl(var(--card))` | `var(--color-card)` | ### Font Variables ```css /* Before */ font-family: var(--font-sans); /* After */ font-family: var(--font-family-sans); ``` ### Shadow Variables ```css /* Before */ box-shadow: var(--shadow); /* After */ box-shadow: var(--shadow-base); ``` ## Icon Migration Replace Font Awesome icons with the SVG icon component: ```html {% include "components/ui/icon.html" with name="search" %} {% include "components/ui/icon.html" with name="user" %} {% include "components/ui/icon.html" with name="heart" %} ``` ### Icon Name Mapping | Font Awesome | SVG Icon | |--------------|----------| | `fa-search` | `search` | | `fa-user` | `user` | | `fa-users` | `users` | | `fa-cog` | `settings` | | `fa-heart` | `heart` | | `fa-star` | `star` | | `fa-home` | `home` | | `fa-edit` | `edit` | | `fa-trash` | `trash` | | `fa-copy` | `copy` | | `fa-external-link` | `external-link` | | `fa-chevron-down` | `chevron-down` | | `fa-chevron-up` | `chevron-up` | | `fa-chevron-left` | `chevron-left` | | `fa-chevron-right` | `chevron-right` | | `fa-check` | `check` | | `fa-times` | `close` | | `fa-plus` | `plus` | | `fa-minus` | `minus` | | `fa-bars` | `menu` | ### Icon Sizes ```html {% include "components/ui/icon.html" with name="search" size="sm" %} {% include "components/ui/icon.html" with name="search" size="lg" %} {% include "components/ui/icon.html" with name="search" size="xl" %} ``` ## Button Migration ### Basic Buttons ```html {% include "components/ui/button.html" with text="Click Me" variant="default" %} {% include "components/ui/button.html" with text="Click Me" variant="secondary" %} {% include "components/ui/button.html" with text="Delete" variant="destructive" %} {% include "components/ui/button.html" with text="Outline" variant="outline" %} ``` ### Buttons with Icons ```html {% include "components/ui/button.html" with text="Search" icon="search" %} ``` ### Link Buttons ```html Go {% include "components/ui/button.html" with text="Go" href="/url" %} ``` ## Form Input Migration ```html
We'll never share your email.
{% include "components/ui/input.html" with name="email" label="Email" type="email" placeholder="Enter email" hint="We'll never share your email." %} ``` ## Card Migration ```html

Title

Content here

{% include "components/ui/card.html" with title="Title" body_content="

Content here

" footer_content="" %} ``` ## Modal Migration ```html {% include "components/ui/dialog.html" with id="myModal" title="Title" content="Content" footer="" %} ``` ## Alpine.js Migration ### Store Definitions Move inline store definitions to `stores/index.js`: ```javascript // Before (inline in template) // After (use centralized store) // Store is already defined in stores/index.js // Access via $store.theme.toggle() ``` ### Component Definitions Move inline component definitions to `alpine-components.js`: ```javascript // Before (inline in template)
Content
// After (use registered component)
Content
``` ## Alert/Toast Migration ```html
Success! Your action was completed.
``` ## Responsive Classes Migration ```html
Hidden on mobile
Only on mobile
...
Hidden on mobile
Only on mobile
...
...
``` ## Checklist Use this checklist when migrating a template: - [ ] Replace HSL color variables with design tokens - [ ] Replace Font Awesome icons with SVG icon component - [ ] Update button markup to use button component - [ ] Update form inputs to use input component - [ ] Update cards to use card component - [ ] Update modals to use dialog component - [ ] Remove inline Alpine.js store definitions - [ ] Update responsive classes - [ ] Test dark mode appearance - [ ] Test focus states for accessibility - [ ] Test on mobile viewport ## Testing Migration After migrating, visit `/design-system-test/` to compare your migrated components against the reference implementation. ## Getting Help If you encounter issues during migration: 1. Check the design system README for component documentation 2. Review `design-tokens.css` for available tokens 3. Inspect the design system test page for examples