teasanctuary.ru/src/lib/components/HoverIcon.svelte

27 lines
586 B
Svelte

<script lang="ts">
import Icon from '@iconify/svelte';
let className: string = '';
export { className as class };
export let src: string | null = null;
export let text: string;
export let size: number = 32;
let isUrl;
$: isUrl = src?.startsWith('/') || src?.startsWith('http');
</script>
<div class="{className} fill-slate-50 text-sm uppercase transition-all">
{#if src}
{#if isUrl}
<img {src} alt={text} width={size} height={size} />
{:else}
<Icon width={size} height={size} icon={src} color="#f8fafc" />
{/if}
{:else}
{text}
{/if}
</div>
<style>
</style>