2022-07-22 09:44:22 -05:00
|
|
|
<script lang="ts">
|
2023-07-01 00:50:47 -04:00
|
|
|
import { browser } from '$app/environment';
|
2022-07-23 13:08:49 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
|
|
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
|
|
|
import { fly } from 'svelte/transition';
|
2023-10-25 09:48:25 -04:00
|
|
|
import { mdiClose } from '@mdi/js';
|
2024-01-01 17:18:22 +01:00
|
|
|
import { isSelectAllCancelled } from '$lib/stores/assets.store';
|
2023-01-09 14:16:08 -06:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
export let showBackButton = true;
|
2023-10-25 09:48:25 -04:00
|
|
|
export let backIcon = mdiClose;
|
2023-07-01 00:50:47 -04:00
|
|
|
export let tailwindClasses = '';
|
|
|
|
export let forceDark = false;
|
2022-07-23 23:23:14 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
let appBarBorder = 'bg-immich-bg border border-transparent';
|
2022-07-23 23:23:14 -05:00
|
|
|
|
2023-12-15 03:54:21 +01:00
|
|
|
const dispatch = createEventDispatcher<{
|
|
|
|
close: void;
|
|
|
|
}>();
|
2022-07-23 13:08:49 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
const onScroll = () => {
|
|
|
|
if (window.pageYOffset > 80) {
|
|
|
|
appBarBorder = 'border border-gray-200 bg-gray-50 dark:border-gray-600';
|
2023-06-14 20:47:18 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
if (forceDark) {
|
|
|
|
appBarBorder = 'border border-gray-600';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
appBarBorder = 'bg-immich-bg border border-transparent';
|
|
|
|
}
|
|
|
|
};
|
2022-09-08 17:30:49 +02:00
|
|
|
|
2024-01-01 17:18:22 +01:00
|
|
|
const handleClose = () => {
|
|
|
|
$isSelectAllCancelled = true;
|
|
|
|
dispatch('close');
|
|
|
|
};
|
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
onMount(() => {
|
|
|
|
if (browser) {
|
|
|
|
document.addEventListener('scroll', onScroll);
|
|
|
|
}
|
|
|
|
});
|
2022-07-23 13:08:49 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
onDestroy(() => {
|
|
|
|
if (browser) {
|
|
|
|
document.removeEventListener('scroll', onScroll);
|
|
|
|
}
|
|
|
|
});
|
2022-07-22 09:44:22 -05:00
|
|
|
</script>
|
|
|
|
|
2023-11-05 18:24:43 +01:00
|
|
|
<div in:fly={{ y: 10, duration: 200 }} class="absolute top-0 w-full z-[100] bg-transparent">
|
2023-07-01 00:50:47 -04:00
|
|
|
<div
|
|
|
|
id="asset-selection-app-bar"
|
2023-07-28 20:03:23 +02:00
|
|
|
class={`grid grid-cols-[10%_80%_10%] justify-between md:grid-cols-[20%_60%_20%] lg:grid-cols-3 ${appBarBorder} mx-2 mt-2 place-items-center rounded-lg p-2 transition-all ${tailwindClasses} dark:bg-immich-dark-gray ${
|
2023-07-01 00:50:47 -04:00
|
|
|
forceDark && 'bg-immich-dark-gray text-white'
|
|
|
|
}`}
|
|
|
|
>
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="flex place-items-center gap-6 justify-self-start dark:text-immich-dark-fg">
|
2023-07-01 00:50:47 -04:00
|
|
|
{#if showBackButton}
|
|
|
|
<CircleIconButton
|
2024-01-01 17:18:22 +01:00
|
|
|
on:click={handleClose}
|
2023-10-25 09:48:25 -04:00
|
|
|
icon={backIcon}
|
2023-07-01 00:50:47 -04:00
|
|
|
backgroundColor={'transparent'}
|
|
|
|
hoverColor={'#e2e7e9'}
|
|
|
|
size={'24'}
|
|
|
|
forceDark
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
<slot name="leading" />
|
|
|
|
</div>
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
<div class="w-full">
|
|
|
|
<slot />
|
|
|
|
</div>
|
2023-03-06 15:31:58 +01:00
|
|
|
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="mr-4 flex place-items-center gap-1 justify-self-end">
|
2023-07-01 00:50:47 -04:00
|
|
|
<slot name="trailing" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-22 09:44:22 -05:00
|
|
|
</div>
|