flotilla/src/lib/components/ImageIcon.svelte

22 lines
474 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
class?: string
2025-10-31 23:18:58 +00:00
}
const {src, alt, size = 5, ...props}: Props = $props()
2025-10-31 23:18:58 +00:00
</script>
{#if src.includes("image/svg") || src.endsWith(".svg")}
<Icon icon={src} {size} class={props.class} />
2025-10-31 23:18:58 +00:00
{:else}
2025-12-02 21:49:04 +00:00
<img
{src}
{alt}
class="h-{size} w-{size} min-w-{size} min-h-{size} aspect-square object-cover {props.class}" />
2025-10-31 23:18:58 +00:00
{/if}