Иконки теперь могут быть чёрными

This commit is contained in:
Иван Кузьменко 2025-07-13 08:51:50 +03:00
parent 5856dc412b
commit 31d21b9c81

View file

@ -6,17 +6,22 @@
export let src: string | null = null; export let src: string | null = null;
export let text: string; export let text: string;
export let size: number = 32; export let size: number = 32;
export let black: boolean = false;
let isUrl; let isUrl;
$: isUrl = src?.startsWith('/') || src?.startsWith('http'); $: isUrl = src?.startsWith('/') || src?.startsWith('http');
</script> </script>
<div class="{className} fill-slate-50 text-sm uppercase transition-all"> <div
class="{className} {black
? 'fill-slate-950'
: 'fill-slate-50'} text-sm uppercase transition-all"
>
{#if src} {#if src}
{#if isUrl} {#if isUrl}
<img {src} alt={text} width={size} height={size} /> <img {src} alt={text} width={size} height={size} />
{:else} {:else}
<Icon width={size} height={size} icon={src} color="#f8fafc" /> <Icon width={size} height={size} icon={src} color={black ? '#020618' : '#f8fafc'} />
{/if} {/if}
{:else} {:else}
{text} {text}