diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-12 22:24:19 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-12 22:24:19 +0200 |
| commit | 5f0a73920034741236034ed7a721c68eceb8ab82 (patch) | |
| tree | c5653093db0484e7474b9d69941666dfc308b083 /src/lib/components/GroceryRow.svelte | |
| parent | 1cef356be95a67f95d40f5b0b131f98d11f13c13 (diff) | |
Extract Row primitive, migrate all call sites
Variants card/ref/plain with scoped skin. Padding and wrap
one-offs via style prop; draggable and handlers via rest
spread. GroceryRow absorbs item-btn/ref-link globals with
local names; BestRef scopes best-ref. Delete item-* globals
and dead page overrides.
Diffstat (limited to 'src/lib/components/GroceryRow.svelte')
| -rw-r--r-- | src/lib/components/GroceryRow.svelte | 71 |
1 files changed, 64 insertions, 7 deletions
diff --git a/src/lib/components/GroceryRow.svelte b/src/lib/components/GroceryRow.svelte index 3305afa..9a88e90 100644 --- a/src/lib/components/GroceryRow.svelte +++ b/src/lib/components/GroceryRow.svelte @@ -1,5 +1,6 @@ <script lang="ts"> import BestRef from '$lib/components/BestRef.svelte'; + import Row from '$lib/components/Row.svelte'; import type { EnrichedGrocery } from '$lib/server/services/groceries'; let { @@ -17,29 +18,29 @@ } = $props(); </script> -<li class="item-row item-row--fixed"> +<Row variant="plain" style="height: 2.75rem;"> {#if selectable} - <input type="checkbox" class="item-check" {checked} onchange={oncheck} /> + <input type="checkbox" class="check" {checked} onchange={oncheck} /> {/if} <button - class="item-btn item-btn--grow" + class="toggle" name="id" value={item.id} type="submit" aria-pressed={item.checked} > - <span class="item-text"> + <span class="label"> <span class:checked={item.checked}>{item.name}</span> {#if item.bestRef} <BestRef ref={item.bestRef} /> {/if} </span> </button> - <a class="ref-link" href="/grocery/{item.id}?from={from}">→</a> -</li> + <a class="open" href="/grocery/{item.id}?from={from}">→</a> +</Row> <style> - .item-check { + .check { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); @@ -52,4 +53,60 @@ color: var(--text-secondary); font-weight: 400; } + + .toggle { + flex-grow: 1; + width: auto; + text-align: left; + padding: 0 0.875rem; + height: 100%; + border: none; + border-radius: 0.75rem; + background: var(--surface); + font-size: 1rem; + font-weight: 500; + display: flex; + align-items: center; + transition: all 0.2s ease; + box-shadow: 0 1px 2px var(--shadow); + } + + .toggle:hover { + background: var(--surface-hover); + box-shadow: 0 2px 6px var(--shadow-accent); + transform: translateY(-1px); + } + + .label { + display: flex; + flex-direction: column; + text-align: left; + line-height: 1.2; + gap: 0.0625rem; + overflow: hidden; + } + + .open { + width: 2.75rem; + flex-shrink: 0; + height: 2.75rem; + aspect-ratio: 1; + display: flex; + align-items: center; + justify-content: center; + border-radius: 0.75rem; + background: var(--surface); + color: var(--text-secondary); + text-decoration: none; + font-size: 1rem; + transition: all 0.2s ease; + box-shadow: 0 1px 2px var(--shadow); + } + + .open:hover { + background: var(--surface-hover); + color: var(--accent); + box-shadow: 0 2px 6px var(--shadow-accent); + transform: translateY(-1px); + } </style> |
