-
Notifications
You must be signed in to change notification settings - Fork 0
docs: UI/UX improvement plan for all examples #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,279 @@ | ||||||
| # Plan: Improve UI/UX of All Examples (Issue #51) | ||||||
|
|
||||||
| ## Problem | ||||||
|
|
||||||
| The examples lack visual polish and consistency. Content stretches too wide, buttons are oversized for their context, controls are spread across multiple rows wasting vertical space, and each example feels like it was built by a different person. Additionally, there are inline styles/JS violating CLAUDE.md and missing accessibility attributes. The goal is to produce cohesive, production-quality examples with tight visual design and establish guidelines for future apps. | ||||||
|
|
||||||
| ## Approach | ||||||
|
|
||||||
| 1. Create a shared `livetemplate.css` with visual utilities (narrow container, compact buttons, visually-hidden) | ||||||
| 2. Apply visual improvements to every template: narrow focused layout, compact action buttons, single-row toolbars, breathing space | ||||||
| 3. Clean up code hygiene: remove inline styles/JS, fix accessibility | ||||||
| 4. Update CLAUDE.md with established visual and coding standards | ||||||
| 5. Verify all tests still pass | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Visual Design Principles | ||||||
|
|
||||||
| These apply to ALL examples: | ||||||
|
|
||||||
| 1. **Narrow, focused layout** — All examples are single-purpose apps. Constrain content to ~640px max-width for a focused feel with breathing space on wider screens. | ||||||
| 2. **Single-row toolbars** — Group related controls (search + sort, action buttons) into one horizontal row using `<fieldset role="group">` or `<nav>`. | ||||||
| 3. **Compact action buttons** — Inline action buttons (delete, toggle, remove) should be small, not full-height Pico buttons. Use a `.compact` utility class. | ||||||
| 4. **Consistent card structure** — Every example: `<article>` card with `<hgroup>` header (title + subtitle), content, optional footer. | ||||||
| 5. **Visual hierarchy** — Primary actions get prominent buttons; secondary/destructive actions get `outline` or `secondary` styling and smaller size. | ||||||
| 6. **Breathing space** — Let Pico's natural spacing work; don't stack multiple full-width elements unnecessarily. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Phase 1: Create Shared CSS (`livetemplate.css`) | ||||||
|
|
||||||
| Create `../client/livetemplate.css` (relative to examples root) with reusable utilities: | ||||||
|
|
||||||
| ```css | ||||||
| /* Narrow container for focused, single-purpose apps */ | ||||||
| :root { | ||||||
| --pico-container-max-width: 640px; | ||||||
| } | ||||||
|
|
||||||
| /* Compact action buttons for inline use in tables and toolbars */ | ||||||
| .compact { | ||||||
| --pico-form-element-spacing-vertical: 0.25rem; | ||||||
| --pico-form-element-spacing-horizontal: 0.5rem; | ||||||
| font-size: 0.875rem; | ||||||
| width: auto; | ||||||
| } | ||||||
|
|
||||||
| /* Visually hidden but accessible to screen readers */ | ||||||
| .visually-hidden { | ||||||
| position: absolute; | ||||||
| width: 1px; | ||||||
| height: 1px; | ||||||
| padding: 0; | ||||||
| margin: -1px; | ||||||
| overflow: hidden; | ||||||
| clip: rect(0, 0, 0, 0); | ||||||
| white-space: nowrap; | ||||||
| border: 0; | ||||||
| } | ||||||
|
|
||||||
| /* Inline form — no margin, for embedding in tables/toolbars */ | ||||||
| .inline { | ||||||
| margin: 0; | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| **Rationale**: These four utilities address the core visual problems: | ||||||
| - `--pico-container-max-width: 640px` → narrow focused layout (breathing space on wide screens) | ||||||
| - `.compact` → smaller buttons for inline actions (delete, toggle, remove) | ||||||
| - `.visually-hidden` → accessible hidden labels | ||||||
| - `.inline` → forms embedded in table cells/toolbars without extra margin | ||||||
|
|
||||||
| All examples will link this via `<link rel="stylesheet" href="/livetemplate.css">` and the Go server will serve it. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Phase 2: Universal HTML & Visual Fixes (All Templates) | ||||||
|
|
||||||
| Apply to ALL 10 templates: | ||||||
|
|
||||||
| 1. **Add `lang="en"`** to `<html>` where missing (6 templates) | ||||||
| 2. **Add `<meta name="color-scheme" content="light dark">`** to all `<head>` blocks | ||||||
| 3. **Remove `data-theme="light"`** from todos template | ||||||
| 4. **Link shared CSS**: `<link rel="stylesheet" href="/livetemplate.css">` in all templates | ||||||
| 5. **Serve shared CSS**: Add `http.Handle("/livetemplate.css", ...)` in each example's main.go (or via the testing framework) | ||||||
|
||||||
| 5. **Serve shared CSS**: Add `http.Handle("/livetemplate.css", ...)` in each example's main.go (or via the testing framework) | |
| 5. **Serve shared CSS**: Register `/livetemplate.css` on the same mux each example passes to `ListenAndServe` (for examples using the default mux, `http.Handle(...)` is fine; for examples using `http.NewServeMux()`, use `mux.Handle(...)` or standardize on one serving pattern). This can also be done via the testing framework. |
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue #51 / PR description calls out putting reusable CSS in ../clients/livetemplate.css, but this plan refers to ../client/livetemplate.css (singular) and later suggests serving it via http.ServeFile from that location. Align the plan with the agreed directory name/location and update the serving approach accordingly so contributors don’t implement the wrong path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan says to create the shared CSS at
../client/livetemplate.css“relative to examples root”, but this repo’s examples root is the repository root and there is noclient/directory here. This path would also point outside the repo from root. Please clarify the intended location within this repository (e.g., aclient/orclients/directory at repo root) and update the plan to use a consistent path that all examples can serve reliably.