feat: Switch to dicebear

This commit is contained in:
Xyphyn committed 2023-07-14 13:39:05 -07:00
1 parent f8278d0419
commit 20ec519407
4 files changed
+75 -7

No files matched your search

+21 -7
View File
@@ -1,14 +1,28 @@
<script lang="ts">
import { createAvatar } from '@dicebear/core'
import * as initials from '@dicebear/initials'
export let url: string | undefined
export let alt: string = ''
export let width: number
</script>
<img
src="{url ?? `/img/logo-background.svg`}?format=webp&thumbnail={width * 2}"
{alt}
{width}
loading="lazy"
class="rounded-full aspect-square object-cover overflow-hidden"
/>
{#if url}
<img
src="{url}?format=webp&thumbnail={width * 2}"
{alt}
{width}
loading="lazy"
class="rounded-full aspect-square object-cover overflow-hidden"
/>
{:else}
<div
style="width: {width}px; height: {width}px;"
class="rounded-full aspect-square object-cover overflow-hidden"
>
{@html createAvatar(initials, {
seed: alt,
}).toString()}
</div>
{/if}