Files
radicle-explorer/src/views/projects/Commit/CommitAuthorship.svelte
T
Rūdolfs Ošiņšanddnlklmn d914710396 Implement new design
Co-authored-by: dnlklmn <pelicansinberlin@gmail.com>
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-10-13 18:05:19 +02:00

59 lines
1.3 KiB
Svelte

<script lang="ts">
import type { CommitHeader } from "@httpd-client";
import { formatTimestamp, gravatarURL } from "@app/lib/utils";
export let header: CommitHeader;
</script>
<style>
.authorship {
display: flex;
font-size: var(--font-size-small);
gap: 0.5rem;
flex-wrap: wrap;
}
.person {
display: flex;
align-items: center;
flex-wrap: nowrap;
white-space: nowrap;
gap: 0.5rem;
}
.avatar {
width: 1rem;
height: 1rem;
border-radius: var(--border-radius-round);
}
</style>
<span class="authorship">
<slot />
{#if header.author.email === header.committer.email}
<div class="person">
<img
class="avatar"
alt="avatar"
src={gravatarURL(header.committer.email)} />
{header.committer.name}
</div>
committed
{formatTimestamp(header.committer.time)}
{:else}
<div class="person">
<img class="avatar" alt="avatar" src={gravatarURL(header.author.email)} />
{header.author.name}
</div>
authored and
<div class="person">
<img
class="avatar"
alt="avatar"
src={gravatarURL(header.committer.email)} />
{header.committer.name}
</div>
committed
{formatTimestamp(header.committer.time)}
{/if}
</span>