flotilla/src/lib/components/ImageIcon.svelte

18 lines
370 B
Svelte
Raw Normal View History

2025-10-31 23:18:58 +00:00
<script lang="ts">
import Icon from "@lib/components/Icon.svelte"
type Props = {
src: string
alt: string
size?: number
2025-10-31 23:18:58 +00:00
}
const {src, alt, size = 5}: Props = $props()
2025-10-31 23:18:58 +00:00
</script>
{#if src.includes("image/svg") || src.endsWith(".svg")}
<Icon icon={src} {size} />
2025-10-31 23:18:58 +00:00
{:else}
<img {src} {alt} class="h-{size} w-{size} rounded-lg object-cover" />
2025-10-31 23:18:58 +00:00
{/if}