flotilla/src/lib/components/Avatar.svelte

18 lines
431 B
Svelte
Raw Normal View History

2024-08-15 21:30:55 +00:00
<script lang="ts">
2024-08-16 17:50:38 +00:00
import cx from "classnames"
2024-08-15 21:30:55 +00:00
import Icon from "@lib/components/Icon.svelte"
export let src
export let size = 7
</script>
<div
2024-08-16 17:50:38 +00:00
class={cx($$props.class, "!flex items-center justify-center overflow-hidden rounded-full")}
2024-08-15 21:30:55 +00:00
style={`width: ${size * 4}px; height: ${size * 4}px;`}>
{#if src}
<img alt="" {src} />
{:else}
2024-08-16 17:50:38 +00:00
<Icon icon="user-rounded" size={Math.round(size * 0.7)} />
2024-08-15 21:30:55 +00:00
{/if}
</div>