flotilla/src/lib/components/Avatar.svelte

19 lines
551 B
Svelte
Raw Normal View History

2024-08-15 21:30:55 +00:00
<script lang="ts">
import Icon from "@lib/components/Icon.svelte"
2024-10-04 00:04:00 +00:00
export let src = ""
2024-08-15 21:30:55 +00:00
export let size = 7
2024-08-23 20:33:36 +00:00
export let icon = "user-rounded"
2025-01-15 18:56:56 +00:00
$: rem = size * 4
2024-08-15 21:30:55 +00:00
</script>
2025-01-15 18:56:56 +00:00
<div
class="{$$props.class} relative !flex shrink-0 items-center justify-center overflow-hidden rounded-full"
style="width: {rem}px; height: {rem}px; min-width: {rem}px; {$$props.style || ''}">
<Icon {icon} size={Math.round(size * 0.8)} />
2024-10-01 21:55:33 +00:00
<div
2025-01-15 18:56:56 +00:00
class="absolute left-0 top-0 h-full w-full bg-cover bg-center"
style="background-image: url({src})" />
</div>