feat(search): add SortDropdown component with direction toggle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-06 13:39:26 +02:00
parent 3f8f3cd938
commit aeed6e0dac
2 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
interface Props {
sort: string;
dir: string;
}
let { sort = $bindable(), dir = $bindable() }: Props = $props();
function toggleDir() {
dir = dir === 'asc' ? 'desc' : 'asc';
}
</script>
<div class="inline-flex items-center gap-1">
<select
role="combobox"
bind:value={sort}
class="border-brand-sand rounded border bg-white px-2 py-1 font-sans text-sm text-brand-navy focus:ring-2 focus:ring-brand-mint focus:outline-none"
>
<option value="DATE">{m.docs_sort_date()}</option>
<option value="TITLE">{m.docs_sort_title()}</option>
<option value="SENDER">{m.docs_sort_sender()}</option>
<option value="RECEIVER">{m.docs_sort_receiver()}</option>
<option value="UPLOAD_DATE">{m.docs_sort_upload()}</option>
</select>
<button
type="button"
onclick={toggleDir}
class="border-brand-sand hover:bg-brand-sand flex items-center justify-center rounded border bg-white px-2 py-1 text-sm text-brand-navy transition-colors"
aria-label={dir === 'asc' ? 'Aufsteigend sortieren' : 'Absteigend sortieren'}
>
{dir === 'asc' ? '↑' : '↓'}
</button>
</div>