mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-14 02:50:51 +08:00
Extracts the avatar components and the style tokens into shared/ui, which both apps consume as a workspace package, to try out ADR 2. Nix and the Docker setups are not updated yet.
27 lines
510 B
Svelte
27 lines
510 B
Svelte
<script lang="ts">
|
|
import { cachedUserAvatar } from "../lib/avatar";
|
|
|
|
interface Props {
|
|
nodeId: string;
|
|
styleWidth: string;
|
|
}
|
|
|
|
const { nodeId, styleWidth }: Props = $props();
|
|
|
|
let dataUri: string | undefined = $state(undefined);
|
|
|
|
$effect(() => {
|
|
void cachedUserAvatar(nodeId.replace("did:key:", "")).then(data => {
|
|
dataUri = data;
|
|
});
|
|
});
|
|
</script>
|
|
|
|
{#if dataUri}
|
|
<img
|
|
style:width={styleWidth}
|
|
style:height={styleWidth}
|
|
src={dataUri}
|
|
alt="Avatar" />
|
|
{/if}
|