MCPcopy Create free account
hub / github.com/arctic-cli/interface / Avatar

Function Avatar

packages/ui/src/components/avatar.tsx:11–44  ·  view source on GitHub ↗
(props: AvatarProps)

Source from the content-addressed store, hash-verified

9}
10
11export function Avatar(props: AvatarProps) {
12 const [split, rest] = splitProps(props, [
13 "fallback",
14 "src",
15 "background",
16 "foreground",
17 "size",
18 "class",
19 "classList",
20 "style",
21 ])
22 const src = split.src // did this so i can zero it out to test fallback
23 return (
24 <div
25 {...rest}
26 data-component="avatar"
27 data-size={split.size || "normal"}
28 data-has-image={src ? "" : undefined}
29 classList={{
30 ...(split.classList ?? {}),
31 [split.class ?? ""]: !!split.class,
32 }}
33 style={{
34 ...(typeof split.style === "object" ? split.style : {}),
35 ...(!src && split.background ? { "--avatar-bg": split.background } : {}),
36 ...(!src && split.foreground ? { "--avatar-fg": split.foreground } : {}),
37 }}
38 >
39 <Show when={src} fallback={split.fallback?.[0]}>
40 {(src) => <img src={src()} draggable={false} class="size-full object-cover" />}
41 </Show>
42 </div>
43 )
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected