import Image from "next/image";
import { resolveMediaUrl } from "@/lib/url";
const avatarSizeMap = {
sm: { className: "h-6 w-6 text-[11px]", px: 24 },
md: { className: "h-7 w-7 text-xs", px: 28 },
lg: { className: "h-8 w-8 text-xs", px: 32 },
} as const;
type RequestAvatarProps = {
alt: string;
fallback: string;
size?: keyof typeof avatarSizeMap;
src?: string | null;
};
export function RequestAvatar({
alt,
fallback,
size = "md",
src,
}: RequestAvatarProps) {
const config = avatarSizeMap[size];
const resolvedSrc = resolveMediaUrl(src);
if (resolvedSrc) {
return (
);
}
return (
{fallback}
);
}