Make filesystem list view columns sortable
This commit is contained in:
23
svelte/src/layout/SortButton.svelte
Normal file
23
svelte/src/layout/SortButton.svelte
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
export let field = ""
|
||||
export let active_field = ""
|
||||
export let asc = true
|
||||
export let sort_func: (field: string) => void
|
||||
</script>
|
||||
|
||||
<button class:button_highlight={active_field === field} on:click={() => sort_func(field)}>
|
||||
{#if active_field === field}
|
||||
{#if asc}↓{:else}↑{/if}
|
||||
{/if}
|
||||
<slot></slot>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
button {
|
||||
display: block;
|
||||
margin: 0;
|
||||
line-height: 1em;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user