import React from "react"; import classNames from "classnames"; export type Props = { /** * The style avatar */ className?: string; /** * The path of image */ src?: string; /** * The alternative text in case the image is not valid */ alt?: string; /** * The text inside avatar as a child */ children?: React.ReactNode; }; const Avatar = ({ className, src, alt, children }: Props) => { return (
{/* In case the src is valid, it will show the image */} {src && ( {alt} )} {/* The text will be shown in case it is valid */} {children && (
{children}
)}
); }; export default Avatar;