immich/web/src/lib/components/elements/table-header.svelte
martin 3aa2927dae
fix(web): sorting options for albums (#5233)
* fix: albums

* pr feedback

* fix: current behavior

* rename

* fix: album metadatas

* fix: tests

* fix: e2e test

* simplify

* fix: cover shared links

* rename function

* merge main

* merge main

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2023-11-26 15:23:43 +00:00

30 lines
721 B
Svelte

<script lang="ts">
import type { Sort } from '../../../routes/(user)/albums/+page.svelte';
export let albumViewSettings: string;
export let option: Sort;
const handleSort = () => {
if (albumViewSettings === option.title) {
option.sortDesc = !option.sortDesc;
} else {
albumViewSettings = option.title;
}
};
</script>
<th class="{option.widthClass} text-sm font-medium"
><button
class="rounded-lg p-2 hover:bg-immich-dark-primary hover:dark:bg-immich-dark-primary/50"
on:click={() => handleSort()}
>
{#if albumViewSettings === option.title}
{#if option.sortDesc}
&#8595;
{:else}
&#8593;
{/if}
{/if}{option.title}</button
></th
>