2023-03-27 05:53:35 +02:00
|
|
|
<script lang="ts">
|
2023-05-17 13:07:17 -04:00
|
|
|
import { imageLoad } from '$lib/utils/image-load';
|
|
|
|
|
|
2023-03-27 05:53:35 +02:00
|
|
|
export let url: string;
|
|
|
|
|
export let altText: string;
|
2023-05-17 13:07:17 -04:00
|
|
|
export let heightStyle: string | undefined = undefined;
|
2023-03-27 05:53:35 +02:00
|
|
|
export let widthStyle: string;
|
2023-05-17 13:07:17 -04:00
|
|
|
export let curve = false;
|
|
|
|
|
export let shadow = false;
|
|
|
|
|
export let circle = false;
|
2023-03-27 05:53:35 +02:00
|
|
|
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}
|
2023-03-27 05:53:35 +02:00
|
|
|
class:opacity-0={loading}
|
|
|
|
|
draggable="false"
|
2023-05-17 13:07:17 -04:00
|
|
|
use:imageLoad
|
|
|
|
|
on:image-load|once={() => (loading = false)}
|
2023-03-27 05:53:35 +02:00
|
|
|
/>
|