From 77dc482dda42f9532ece78c4c568b37658270c0a Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 12 Aug 2020 04:26:54 +0300 Subject: feat: improve Avatar --- src/components/Avatar/Avatar.tsx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/components/Avatar/Avatar.tsx') diff --git a/src/components/Avatar/Avatar.tsx b/src/components/Avatar/Avatar.tsx index e445891..29754c9 100644 --- a/src/components/Avatar/Avatar.tsx +++ b/src/components/Avatar/Avatar.tsx @@ -1,35 +1,27 @@ 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; + user?: User; className?: string; } const Avatar: React.FC = ({ user, className }) => { const history = useHistory(); - const { username, avatarUrl } = user; const handleClick = () => { - history.push(`/profile/${username}`); + if (user) history.push(`/profile/${user.username}`); }; - return avatarUrl ? ( + return ( - ) : ( - ); }; -- cgit v1.2.3