From a398f8cf44e6a30c0f90a7eba91ba53f435956b3 Mon Sep 17 00:00:00 2001 From: Josh Rogers Date: Thu, 14 May 2026 20:13:36 -0500 Subject: [PATCH] Fix form control consistency; add frontend style guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QuantityInput unit select: add bg-white (browser defaults to gray without it) and capitalize default option to "Unit" - Shopping list section dropdowns: rename "Uncategorized" → "No section" for consistent title-case phrasing across all default options - src/frontend/STYLE_GUIDE.md: documents form control classes, button variants, text casing rules, icon usage, color tokens, and spacing rhythm so all future UI work stays consistent - CLAUDE.md: link to the style guide so it is always consulted Co-Authored-By: Claude Opus 4.7 (1M context) --- CLAUDE.md | 2 + src/frontend/STYLE_GUIDE.md | 71 +++++++++++++++++++ src/frontend/src/lib/QuantityInput.svelte | 4 +- .../src/routes/lists/[id]/+page.svelte | 4 +- 4 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 src/frontend/STYLE_GUIDE.md diff --git a/CLAUDE.md b/CLAUDE.md index 068ddbb..cafd896 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -88,6 +88,8 @@ When adding a feature: create `Features//Endpoints.cs` with a `Map(path, opts)` helper. Stores the JWT in `localStorage` under `token`, attaches `Authorization: Bearer …`, and on 401 it clears the token and `goto('/login')`. - `src/lib/auth.svelte.ts` — runes-based auth state. diff --git a/src/frontend/STYLE_GUIDE.md b/src/frontend/STYLE_GUIDE.md new file mode 100644 index 0000000..75e8fbd --- /dev/null +++ b/src/frontend/STYLE_GUIDE.md @@ -0,0 +1,71 @@ +# Frontend Style Guide + +Rules that apply to every component. Deviating from these requires an explicit reason. + +## Form controls + +All interactive inputs, selects, and textareas share one baseline class set so they look identical regardless of type: + +``` +rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm +focus:border-primary focus:outline-none +``` + +| Variant | When to use | Size note | +|---|---|---| +| **Standard** (`px-3 py-2`) | Inline rows (qty, unit, section dropdowns, filters) | `text-sm` | +| **Large** (`px-3 py-2.5 text-base`) | Full-width, standalone inputs (item name, recipe title) | `text-base` | + +**Rules:** +- `bg-white` is **always explicit** on `