diff --git a/backend/src/main/resources/content/platform/frontend-template/rules.md b/backend/src/main/resources/content/platform/frontend-template/rules.md new file mode 100644 index 0000000..bd08a19 --- /dev/null +++ b/backend/src/main/resources/content/platform/frontend-template/rules.md @@ -0,0 +1,76 @@ +--- +module: platform.frontend-template +title: Frontend Template — starting a new SPA +tab: Rules & Gotchas +order: 20 +audience: dev +--- + +# Design-system rules & hard-won gotchas + +The canonical CSS to **copy verbatim** lives in the template repo's +`frontend/src/components/TablePage.svelte` (plain list/table pages) and `TemplatePage.svelte` +(pages with severity/status badges) — copy those files, don't rewrite. This tab captures the +**rules and gotchas** that aren't obvious from the files. + +## Colors + +| Token | Value | Used for | +|-------|-------|----------| +| `--color-primary` / `-hover` | `#2563eb` / `#1d4ed8` | buttons, links, active highlights | +| `--color-danger` | `#d32f2f` | delete/error | +| `--color-success` / `--color-warning` | `#2e7d32` / `#b45309` | badges | +| `--color-border` | `#e0e0e0` | card/table borders | +| `--color-text-primary` / `-secondary` | `#1a1a1a` / `#666` | body / muted | + +**Sidebar gradient (canonical — do not change per app):** +Light `linear-gradient(180deg, #081651 0%, #1c49b8 100%)` · Dark `linear-gradient(180deg, #050e2e 0%, #0f2460 100%)`. +(For brand/customer-facing artifacts use the BCOS palette instead — see `platform.branding`. The +`#2563eb` above is the app-template blue, not the brand.) + +## Base font size — CRITICAL + +Every app **must** set `font-size: 14px` on `html, body`. All `rem` values are relative to it; +omit it and the browser defaults to 16px → every nav item, cell, and badge is ~14% too large. + +```css +:global(html), :global(body) { font-size: 14px; } /* required — do not omit */ +``` + +Typography scale (relative to 14px): page-title `1.4rem` · section-title `1.1rem` · body `0.95rem` · +body-sm `0.9rem` · **label `0.85rem` (table cells, form labels)** · caption `0.8rem` · tiny `0.75rem` +(uppercase table headers) · subtitle `0.85rem` (`.header p`) · icon `1.1rem` · stat-value `2rem`. + +## CSS isolation — four rules (these burned real hours) + +1. **Use Svelte `