import styles from '@components/Avatar.module.css'; import * as React from 'react'; import * as Utilities from '@common/utilities'; interface AvatarProps extends Omit, 'style' | 'className' | 'children'> { src?: string; href?: string; target?: string; style?: React.CSSProperties; children?: React.ReactNode; } const Avatar: React.FC = (props) => { const { src, style: propStyle, href, target, children, ...rest } = props; const backgroundStyle = src ? { backgroundImage: `url(${src})` } : {}; const combinedStyle = { ...propStyle, ...backgroundStyle }; let avatarElement: React.ReactElement; if (href) { avatarElement = ; } else { avatarElement =
; } if (!children) { return avatarElement; } return (
{avatarElement} {children}
); }; export default Avatar;