feat(frontend): self host avatar placeholders
This commit is contained in:
parent
67dae103d8
commit
0c187aaf84
4 changed files with 15 additions and 7 deletions
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { defaultAvatars } from "$lib/api/entities";
|
||||
|
||||
export let urls: string[];
|
||||
export let alt: string;
|
||||
export let width = 300;
|
||||
|
@ -14,6 +16,8 @@
|
|||
return "application/octet-stream";
|
||||
}
|
||||
};
|
||||
|
||||
$: urls = urls.length > 0 ? urls : defaultAvatars;
|
||||
</script>
|
||||
|
||||
{#if urls.length > 0}
|
||||
|
@ -21,9 +25,8 @@
|
|||
{#each urls as url}
|
||||
<source {width} srcSet={url} type={contentTypeFor(url)} />
|
||||
{/each}
|
||||
<img {width} src={urls[0]} {alt} class="rounded-circle img-fluid" />
|
||||
<img {width} src={urls[0] || defaultAvatars[0]} {alt} class="rounded-circle img-fluid" />
|
||||
</picture>
|
||||
{:else}
|
||||
<!-- TODO: actual placeholder that isn't a cat -->
|
||||
<img {width} class="rounded-circle img-fluid" src="https://placekitten.com/512/512" {alt} />
|
||||
<img {width} class="rounded-circle img-fluid" src={defaultAvatars[0]} {alt} />
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue