import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts";
import { StatusIndicator } from "$/ui/objects/StatusIndicator.tsx";
export type Props = Polymorphic<{
"as"?: Tag;
"src"?: string;
"icon"?: JSX.Element;
"children"?: JSX.Element;
"class"?: string;
"circle"?: boolean;
"placeholder"?: boolean;
"color"?: `hsl(${number}, ${number}%, ${number}%)`;
"color2"?: `hsl(${number}, ${number}%, ${number}%)`;
"color-angle"?: number | `${number}`;
"size"?: "xs" | "sm" | "lg" | "xl" | "xxl" | "xxxl";
"status"?: "accent" | "positive" | "negative" | "warning";
}>;
const hslRegex = /^hsl\(([\d.]+), ([\d.]+%), ([\d.]+%)\)$/;
export const Avatar = ({
children,
as: Tag = "div" as T,
src,
icon,
circle,
placeholder,
color,
color2,
"color-angle": colorAngle,
size,
status,
class: cls,
...props
}: Props) => (
{status && }
{icon && {icon}
}
{src ? (
) : (
{children}
)}
);