wip(desktop): progress

This commit is contained in:
Adam
2025-12-10 12:48:08 -06:00
parent 804ad5897f
commit 91d743ef9a
10 changed files with 163 additions and 102 deletions

View File

@@ -9,22 +9,23 @@ export interface AvatarProps extends ComponentProps<"div"> {
export function Avatar(props: AvatarProps) {
const [split, rest] = splitProps(props, ["fallback", "src", "background", "size", "class", "classList", "style"])
const src = split.src // did this so i can zero it out to test fallback
return (
<div
{...rest}
data-component="avatar"
data-size={split.size || "normal"}
data-has-image={split.src ? "" : undefined}
data-has-image={src ? "" : undefined}
classList={{
...(split.classList ?? {}),
[split.class ?? ""]: !!split.class,
}}
style={{
...(typeof split.style === "object" ? split.style : {}),
...(!split.src && split.background ? { "--avatar-bg": split.background } : {}),
...(!src && split.background ? { "--avatar-bg": split.background } : {}),
}}
>
<Show when={split.src} fallback={split.fallback?.[0]}>
<Show when={src} fallback={split.fallback?.[0]}>
{(src) => <img src={src()} draggable={false} class="size-full object-cover" />}
</Show>
</div>