Separate out AuhtorIcon component from list component

This commit is contained in:
Mattias Granlund 2023-12-03 19:01:19 +01:00
parent 444b15631a
commit 50209b4bf7
2 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,15 @@
<script lang="ts">
import type { Author } from '$lib/vbranches/types';
export let author: Author;
</script>
<img
class="-ml-1 inline-block h-4 w-4 rounded-full first:ml-0"
title="Gravatar for {author.email}"
alt="Gravatar for {author.email}"
srcset="{author.gravatarUrl} 2x"
width="100"
height="100"
on:error
/>

View File

@ -1,19 +1,14 @@
<script lang="ts">
import type { Author } from '$lib/vbranches/types';
import AuthorIcon from './AuthorIcon.svelte';
export let authors: Author[];
</script>
<div>
{#each authors as author}
<img
class="-ml-1 inline-block h-4 w-4 rounded-full first:ml-0"
title="Gravatar for {author.email}"
alt="Gravatar for {author.email}"
srcset="{author.gravatarUrl} 2x"
width="100"
height="100"
on:error
/>
{#if author.gravatarUrl}
<AuthorIcon {author} />
{/if}
{/each}
</div>