2022-12-09 15:51:42 -05:00
|
|
|
<script lang="ts">
|
2023-07-01 00:50:47 -04:00
|
|
|
import { quintOut } from 'svelte/easing';
|
|
|
|
import { fly } from 'svelte/transition';
|
2023-09-03 02:21:51 -04:00
|
|
|
import { createEventDispatcher } from 'svelte';
|
2024-01-18 02:52:11 +01:00
|
|
|
import Slider from '$lib/components/elements/slider.svelte';
|
2023-01-22 02:09:02 +00:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
export let title: string;
|
|
|
|
export let subtitle = '';
|
|
|
|
export let checked = false;
|
|
|
|
export let disabled = false;
|
|
|
|
export let isEdited = false;
|
2023-09-03 02:21:51 -04:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher<{ toggle: boolean }>();
|
2022-12-09 15:51:42 -05:00
|
|
|
</script>
|
|
|
|
|
2024-01-19 09:57:15 -05:00
|
|
|
<div class="flex place-items-center justify-between">
|
|
|
|
<div>
|
|
|
|
<div class="flex h-[26px] place-items-center gap-1">
|
|
|
|
<label class="font-medium text-immich-primary dark:text-immich-dark-primary text-sm" for={title}>
|
|
|
|
{title}
|
|
|
|
</label>
|
|
|
|
{#if isEdited}
|
|
|
|
<div
|
|
|
|
transition:fly={{ x: 10, duration: 200, easing: quintOut }}
|
|
|
|
class="rounded-full bg-orange-100 px-2 text-[10px] text-orange-900"
|
|
|
|
>
|
|
|
|
Unsaved change
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
2023-12-17 00:17:38 +01:00
|
|
|
|
2024-01-19 09:57:15 -05:00
|
|
|
<p class="text-sm dark:text-immich-dark-fg">{subtitle}</p>
|
|
|
|
</div>
|
|
|
|
<Slider bind:checked {disabled} on:toggle={() => dispatch('toggle', checked)} />
|
|
|
|
</div>
|