Files
immich/web/src/lib/components/assets/thumbnail/image-thumbnail.svelte

28 lines
660 B
Svelte
Raw Normal View History

<script lang="ts">
2023-05-17 13:07:17 -04:00
import { imageLoad } from '$lib/utils/image-load';
export let url: string;
export let altText: string;
2023-05-17 13:07:17 -04:00
export let heightStyle: string | undefined = undefined;
export let widthStyle: string;
2023-05-17 13:07:17 -04:00
export let curve = false;
export let shadow = false;
export let circle = false;
let loading = true;
</script>
<img
style:width={widthStyle}
style:height={heightStyle}
src={url}
alt={altText}
class="object-cover transition-opacity duration-300"
2023-05-17 13:07:17 -04:00
class:rounded-lg={curve}
class:shadow-lg={shadow}
class:rounded-full={circle}
class:opacity-0={loading}
draggable="false"
2023-05-17 13:07:17 -04:00
use:imageLoad
on:image-load|once={() => (loading = false)}
/>