2023-09-24 15:22:46 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type { Sort } from '../../../routes/(user)/albums/+page.svelte';
|
|
|
|
|
|
|
|
|
|
export let albumViewSettings: string;
|
|
|
|
|
export let option: Sort;
|
|
|
|
|
|
|
|
|
|
const handleSort = () => {
|
2023-11-26 16:23:43 +01:00
|
|
|
if (albumViewSettings === option.title) {
|
2023-09-24 15:22:46 +02:00
|
|
|
option.sortDesc = !option.sortDesc;
|
|
|
|
|
} else {
|
2023-11-26 16:23:43 +01:00
|
|
|
albumViewSettings = option.title;
|
2023-09-24 15:22:46 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</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()}
|
|
|
|
|
>
|
2023-11-26 16:23:43 +01:00
|
|
|
{#if albumViewSettings === option.title}
|
2023-09-24 15:22:46 +02:00
|
|
|
{#if option.sortDesc}
|
|
|
|
|
↓
|
|
|
|
|
{:else}
|
|
|
|
|
↑
|
|
|
|
|
{/if}
|
2023-11-26 16:23:43 +01:00
|
|
|
{/if}{option.title}</button
|
2023-09-24 15:22:46 +02:00
|
|
|
></th
|
|
|
|
|
>
|