web: busy character animation

This commit is contained in:
2026-05-03 17:52:50 -07:00
parent 89bd418566
commit 2403dd99ae
4 changed files with 36 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
import { useEffect } from "preact/hooks";
import { cn } from "@/lib/utils";
const CHARACTER_IDLE_SRC = "/character-idle.gif";
const CHARACTER_BUSY_SRC = "/character-busy.gif";
type SybilCharacterProps = {
className?: string;
isBusy?: boolean;
};
export function SybilCharacter({ className, isBusy = false }: SybilCharacterProps) {
useEffect(() => {
const busyImage = new Image();
busyImage.src = CHARACTER_BUSY_SRC;
}, []);
return (
<img
aria-hidden="true"
alt=""
className={cn(
"aspect-square rounded-xl border border-violet-200/24 bg-white/6 object-cover p-1 shadow-[inset_0_1px_0_hsl(252_90%_86%/0.12),0_10px_24px_hsl(240_80%_2%/0.3)]",
className
)}
data-state={isBusy ? "busy" : "idle"}
draggable={false}
src={isBusy ? CHARACTER_BUSY_SRC : CHARACTER_IDLE_SRC}
/>
);
}