uniform favicons

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-09-29 16:05:15 +02:00
parent d7ee3e82c8
commit 195eaf3159
3 changed files with 49 additions and 45 deletions

View File

@@ -0,0 +1,30 @@
<script lang="ts">
import { Database, Key, Mail } from "@lucide/svelte";
import { cn } from "../utils";
let { url, icon="", class: className = "" } = $props();
let hasError = $state(false);
</script>
<div
class={cn(
"w-10 h-10 rounded-box bg-neutral text-neutral-content items-center justify-center flex",
className,
)}
>
{#if url && !hasError}
<img
src={"https://icons.duckduckgo.com/ip3/" + url + ".ico"}
class="rounded-box w-full h-full"
alt="Favicon de {url}"
onerror={() => { hasError = true }}
/>
{:else if icon == "password"}
<Key />
{:else if icon == "email"}
<Mail />
{:else}
<Database />
{/if}
</div>