import React, { MouseEventHandler as F } from 'react'; import classNames from 'classnames'; import { AvatarIcon } from './Icons'; import { PropsWithElementAttributes } from '../utils'; export type AvatarProps = PropsWithElementAttributes<{ alt?: string; circle?: boolean; image?: T extends HTMLImageElement ? string : never; onClick?: F; rounded?: boolean; size?: number; }>; export function Avatar({ size, image, alt, rounded, circle, onClick, className, style = size ? { width: `${size}px`, height: `${size}px` } : undefined, }: AvatarProps) { const cn = classNames('raf-avatar', className, { 'raf-avatar--rounded': rounded, 'raf-avatar--circle': circle, }); return image ? ( {alt} /> ) : ( } /> ); }