import React from 'react'; import { useHistory } from 'react-router-dom'; import { Avatar as AvatarBase } from '@material-ui/core'; import AccountCircle from '@material-ui/icons/AccountCircle'; import { User } from 'which-types'; interface PropTypes { user: User; className?: string; } const Avatar: React.FC = ({ user, className }) => { const history = useHistory(); const { username, avatarUrl } = user; const handleClick = () => { history.push(`/profile/${username}`); }; return avatarUrl ? ( ) : ( ); }; export default Avatar;