2025-04-02 15:12:38 +02:00
|
|
|
<script lang="ts">
|
2024-02-28 15:50:57 +01:00
|
|
|
export let field = ""
|
|
|
|
export let active_field = ""
|
|
|
|
export let asc = true
|
2025-04-02 15:12:38 +02:00
|
|
|
export let sort_func: (field: string) => void
|
2024-02-28 15:50:57 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<button class:button_highlight={active_field === field} on:click={() => 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}
|
|
|
|
<slot></slot>
|
|
|
|
</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%;
|
|
|
|
text-align: center;
|
2024-02-28 15:50:57 +01:00
|
|
|
}
|
|
|
|
</style>
|