import * as AvatarPrimitive from "@radix-ui/react-avatar"; import * as Tooltip from "@radix-ui/react-tooltip"; import { Check } from "react-feather"; import classNames from "@calcom/lib/classNames"; import { defaultAvatarSrc } from "@calcom/lib/defaultAvatarImage"; import { Maybe } from "@trpc/server"; export type AvatarProps = { className?: string; size: "sm" | "md" | "mdLg" | "lg"; imageSrc?: Maybe; title?: string; alt: string; gravatarFallbackMd5?: string; accepted?: boolean; }; const sizesPropsBySize = { sm: "w-6", // 24px md: "w-8", // 32px mdLg: "w-10", //40px lg: "w-16", // 64px } as const; export default function Avatar(props: AvatarProps) { const { imageSrc, gravatarFallbackMd5, size, alt, title } = props; const sizeClassname = sizesPropsBySize[size]; const rootClass = classNames("rounded-full aspect-square", sizeClassname, "h-auto"); const avatar = ( {gravatarFallbackMd5 && ( {alt} )} {props.accepted && (
{size === "lg" && }
)}
); return title ? ( {avatar} {title} ) : ( <>{avatar} ); }