This commit is contained in:
23
src/lib/map-finder/Artwork.svelte
Normal file
23
src/lib/map-finder/Artwork.svelte
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
let { src, class: className = '' }: { src?: string; class?: string } = $props();
|
||||
let failed = $state(false);
|
||||
$effect(() => {
|
||||
void src;
|
||||
failed = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class={`overflow-hidden rounded bg-gray-200 ${className}`}>
|
||||
{#if src?.startsWith('https://') && !failed}<img
|
||||
{src}
|
||||
alt=""
|
||||
class="h-full w-full object-cover"
|
||||
loading="lazy"
|
||||
onerror={() => (failed = true)}
|
||||
/>{:else}<div
|
||||
class="flex h-full items-center justify-center text-2xl text-gray-500"
|
||||
aria-hidden="true"
|
||||
>
|
||||
♫
|
||||
</div>{/if}
|
||||
</div>
|
||||
Reference in New Issue
Block a user