style(wishlist): Sortierung als Pill-Chips wie auf der Startseite
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m16s

Das native <select> fiel stilistisch aus dem App-Bild. Jetzt
identisch zur "Alle Rezepte"-Sortierung auf der Startseite: drei
grüne Pill-Chips (Beliebteste / Neueste / Älteste), aktive Pille
invertiert. Verhalten gleich, nur die Optik angepasst.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-18 15:10:52 +02:00
parent 194aee269e
commit 297281e201

View File

@@ -6,6 +6,12 @@
import { alertAction, confirmAction } from '$lib/client/confirm.svelte'; import { alertAction, confirmAction } from '$lib/client/confirm.svelte';
import type { WishlistEntry, SortKey } from '$lib/server/wishlist/repository'; import type { WishlistEntry, SortKey } from '$lib/server/wishlist/repository';
const SORT_OPTIONS: { value: SortKey; label: string }[] = [
{ value: 'popular', label: 'Beliebteste' },
{ value: 'newest', label: 'Neueste' },
{ value: 'oldest', label: 'Älteste' }
];
let entries = $state<WishlistEntry[]>([]); let entries = $state<WishlistEntry[]>([]);
let loading = $state(true); let loading = $state(true);
let sort = $state<SortKey>('popular'); let sort = $state<SortKey>('popular');
@@ -80,15 +86,19 @@
<p class="sub">Das wollen wir bald mal essen.</p> <p class="sub">Das wollen wir bald mal essen.</p>
</header> </header>
<div class="controls"> <div class="sort-chips" role="tablist" aria-label="Sortierung">
<label> {#each SORT_OPTIONS as s (s.value)}
Sortieren: <button
<select bind:value={sort}> type="button"
<option value="popular">Am meisten gewünscht</option> role="tab"
<option value="newest">Neueste zuerst</option> aria-selected={sort === s.value}
<option value="oldest">Älteste zuerst</option> class="chip"
</select> class:active={sort === s.value}
</label> onclick={() => (sort = s.value)}
>
{s.label}
</button>
{/each}
</div> </div>
{#if loading} {#if loading}
@@ -162,24 +172,32 @@
margin: 0.2rem 0 0; margin: 0.2rem 0 0;
color: #666; color: #666;
} }
.controls { .sort-chips {
display: flex; display: flex;
justify-content: flex-end; flex-wrap: wrap;
padding: 0.5rem 0 1rem; gap: 0.35rem;
margin: 0.5rem 0 1rem;
} }
.controls label { .chip {
display: inline-flex; padding: 0.4rem 0.85rem;
gap: 0.5rem;
align-items: center;
font-size: 0.9rem;
color: #555;
}
.controls select {
padding: 0.5rem 0.75rem;
border: 1px solid #cfd9d1;
border-radius: 10px;
min-height: 40px;
background: white; background: white;
border: 1px solid #cfd9d1;
border-radius: 999px;
color: #2b6a3d;
font-size: 0.88rem;
cursor: pointer;
min-height: 36px;
font-family: inherit;
white-space: nowrap;
}
.chip:hover {
background: #f4f8f5;
}
.chip.active {
background: #2b6a3d;
color: white;
border-color: #2b6a3d;
font-weight: 600;
} }
.muted { .muted {
color: #888; color: #888;