import classNames from 'classnames' export interface IVAvatarProps { /** the default className contains the default width, w-10 h-10. include a width if overriding this! */ className?: string name?: string imageUrl?: string | null /** customize the text size if needed; the default should be OK for most usage */ textSizeClassName?: string shape?: 'circle' | 'roundrect' } export default function IVAvatar(props: IVAvatarProps) { const { className = 'w-10 h-10', textSizeClassName = 'text-base', shape = 'circle', } = props const initials = props.name ?.toUpperCase() .split(' ') .map(word => word[0]) .join('') .slice(0, 2) return ( {props.imageUrl ? ( {props.name} ) : ( {initials} )} ) }