Files
fnx_web/svelte/src/layout/SortButton.svelte

24 lines
444 B
Svelte
Raw Normal View History

<script lang="ts">
2024-02-28 15:50:57 +01:00
export let field = ""
export let active_field = ""
export let asc = true
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}
{#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>