All checks were successful
Test and deploy staging / staging (push) Successful in 1m46s
25 lines
630 B
Svelte
25 lines
630 B
Svelte
<script lang="ts">
|
|
import Music2 from 'lucide-svelte/icons/music-2';
|
|
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"
|
|
>
|
|
<Music2 size={28} />
|
|
</div>{/if}
|
|
</div>
|