feat(search): add SortDropdown component with direction toggle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
36
frontend/src/lib/components/SortDropdown.svelte
Normal file
36
frontend/src/lib/components/SortDropdown.svelte
Normal 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>
|
||||
Reference in New Issue
Block a user