2025-04-02 15:12:38 +02:00
|
|
|
<script lang="ts">
|
2025-10-13 16:05:50 +02:00
|
|
|
let {
|
|
|
|
field = "",
|
|
|
|
active_field = "",
|
|
|
|
asc = true,
|
|
|
|
sort_func,
|
|
|
|
children
|
|
|
|
}: {
|
|
|
|
field?: string;
|
|
|
|
active_field?: string;
|
|
|
|
asc?: boolean;
|
|
|
|
sort_func: (field: string) => void;
|
|
|
|
children?: import('svelte').Snippet;
|
|
|
|
} = $props();
|
2024-02-28 15:50:57 +01:00
|
|
|
</script>
|
|
|
|
|
2025-10-13 16:05:50 +02:00
|
|
|
<button onclick={() => sort_func(field)}>
|
2024-02-29 23:32:07 +01:00
|
|
|
{#if active_field === field}
|
2025-04-02 15:12:38 +02:00
|
|
|
{#if asc}↓{:else}↑{/if}
|
2024-02-28 15:50:57 +01:00
|
|
|
{/if}
|
2025-10-13 16:05:50 +02:00
|
|
|
{@render children?.()}
|
2024-02-28 15:50:57 +01:00
|
|
|
</button>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
button {
|
2024-04-10 18:35:51 +02:00
|
|
|
display: block;
|
2024-02-28 15:50:57 +01:00
|
|
|
margin: 0;
|
2024-02-29 23:32:07 +01:00
|
|
|
line-height: 1em;
|
2024-04-10 18:35:51 +02:00
|
|
|
width: 100%;
|
2025-10-09 15:48:23 +02:00
|
|
|
text-align: initial;
|
2024-02-28 15:50:57 +01:00
|
|
|
}
|
|
|
|
</style>
|