Lab 15: Capstone — Responsive Dashboard

Time: 30 minutes | Level: Practitioner | Docker: docker run -it --rm node:20-alpine sh

Overview

Build a complete, production-quality analytics dashboard combining all Practitioner skills: CSS Grid + Flexbox layout, dark/light theme via CSS custom properties, CSS animations for chart bars, accessible forms, SVG icon system, BEM methodology, and stylelint/html-validate validation.


Step 1: Design System Setup

/* dashboard.css — Design tokens + BEM architecture */

/* Settings */
:root {
  /* Color palette */
  --color-primary:     oklch(57% 0.20 250);
  --color-success:     oklch(57% 0.17 145);
  --color-warning:     oklch(75% 0.17 70);
  --color-danger:      oklch(55% 0.22 25);
  
  /* Semantic tokens */
  --color-bg:          #f9fafb;
  --color-surface:     #ffffff;
  --color-surface-2:   #f3f4f6;
  --color-text:        #111827;
  --color-text-muted:  #6b7280;
  --color-border:      #e5e7eb;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  
  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

[data-theme="dark"] {
  --color-bg:         #0f172a;
  --color-surface:    #1e293b;
  --color-surface-2:  #334155;
  --color-text:       #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-border:     #334155;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg:         #0f172a;
    --color-surface:    #1e293b;
    --color-surface-2:  #334155;
    --color-text:       #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-border:     #334155;
  }
}

Step 2: Layout Structure (HTML + Grid)


Step 3: Layout CSS


Step 4: Topbar, KPI Cards, Chart Animation


Step 5: JavaScript Theme Toggle


Step 6: Reduced Motion Support


Step 7: Responsive & Accessibility Polish


Step 8: Capstone Validation

📸 Verified Output:


Summary — Skills Combined

Skill
Applied

CSS Grid

grid-template-columns: 240px 1fr

Flexbox

Sidebar, topbar, KPI cards

Custom properties

Full design token system

Dark mode

[data-theme] + prefers-color-scheme

CSS animations

Bar chart grow animation

BEM

.kpi-card__value, .btn--primary

Responsive

Mobile: @media (max-width: 768px)

Accessible forms

Labels, focus-visible, aria

SVG icons

Symbol + <use> system

Reduced motion

@media (prefers-reduced-motion)

Skip link

Keyboard navigation

content-visibility

Off-screen performance

html-validate

Zero errors ✓

Last updated