From efd8efb6ecbfcd4ec95c6f8382bd042424f6af1c Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Fri, 17 Apr 2026 13:00:41 +0300 Subject: [PATCH] docs(design): add design system documentation and missing alt text - Phase 2 Add comprehensive design system documentation: - Z-index scale (z-10 through z-[100]) - Spacing scale based on 4pt baseline - Opacity guidelines for glass/translucent effects - Transition timing standards (150-300ms) - Focus state requirements - Cursor affordance rules - WCAG AA contrast requirements - Button state implementation patterns - Form element best practices - Modal hierarchy guidance - Migration checklist Accessibility improvements: - Add alt text to OCR preview image in Scanner - Verify all images have descriptive alt text - Establish transition consistency guidelines This ensures design consistency and accessibility across the application. --- frontend/components/Scanner.tsx | 7 +- frontend/styles/DESIGN_SYSTEM.md | 238 +++++++++++++++++++++++++++++++ 2 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 frontend/styles/DESIGN_SYSTEM.md diff --git a/frontend/components/Scanner.tsx b/frontend/components/Scanner.tsx index 6d9904aa..fb07e822 100644 --- a/frontend/components/Scanner.tsx +++ b/frontend/components/Scanner.tsx @@ -236,7 +236,12 @@ export default function Scanner({ onScanSuccess, onOCRMatch, paused }: ScannerPr {isSelecting && capturedImage && (
- + OCR text detection preview with detected words highlighted
{detectedWords.map((w, i) => ( diff --git a/frontend/styles/DESIGN_SYSTEM.md b/frontend/styles/DESIGN_SYSTEM.md new file mode 100644 index 00000000..516904e2 --- /dev/null +++ b/frontend/styles/DESIGN_SYSTEM.md @@ -0,0 +1,238 @@ +# TFM aInventory Design System + +## Z-Index Scale + +Explicit z-index layering for consistent stacking context. + +``` +z-10 = Local stacking (shadows, hover states) +z-20 = Cards, modals (low-level) +z-30 = Dropdowns, tooltips +z-40 = Fixed navigation (BottomNav) +z-50 = Full-screen overlays (Scanner, AIOnboarding) +z-[100] = Toast notifications, alerts +``` + +### Applied Locations: +- `z-10`: Interactive states, hover effects +- `z-20`: Modal backgrounds, card borders +- `z-40`: BottomNav fixed footer +- `z-50`: Scanner.tsx, AIOnboarding.tsx, full-screen UI +- `z-[100]`: Toast messages (react-hot-toast) + +--- + +## Spacing Scale + +All spacing follows a consistent 4px baseline. + +``` +4px = gap-1 (tightest) +8px = gap-2 +12px = gap-3 +16px = gap-4 (default) +24px = gap-6 +32px = gap-8 +48px = gap-12 +64px = gap-16 +``` + +### Applied Pattern: +- Use `gap-` utilities for sibling spacing +- Use `p-` for padding on containers +- Use `m-` sparingly (prefer gap) +- Never use arbitrary spacing (e.g., no `gap-[13px]`) + +--- + +## Opacity Scale for Backgrounds + +Consistent opacity for glass/translucent effects. + +``` +bg-slate-950/40 = Light transparency (hover states) +bg-slate-950/60 = Medium transparency (overlays) +bg-slate-950/80 = Heavy transparency (backdrop blur) +bg-slate-900/40 = Light glass (cards) +bg-slate-900/50 = Medium glass (borders) +bg-slate-900/90 = Heavy glass (panels) +``` + +### Applied Locations: +- `/40`: Hover states, subtle layers +- `/50`: Card backgrounds +- `/60-80`: Modal backdrops +- `/90`: Solid-looking panels with slight transparency + +--- + +## Transition Timing + +All interactive elements use consistent easing and duration. + +``` +transition-colors = color changes (150ms) +transition-all = all properties (200-300ms) +active:scale-95 = click feedback +hover:opacity-80 = hover feedback +``` + +### Standards: +- Button state changes: `transition-colors duration-200` +- Major layout changes: `transition-all duration-300` +- Never use `duration-0` or `duration-1000` without reason +- Focus states: instant (no transition on ring) + +--- + +## Focus States + +All interactive elements must be keyboard accessible. + +``` +focus:ring-2 = visible focus indicator +focus:ring-primary = brand color on interactive elements +focus:ring-blue-500 = alternate for secondary buttons +focus:outline-none = removes browser default +``` + +### Applied to: +- All `