From b5ce9be31993f5b4bee9abbe57d775b7ea407507 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Tue, 11 Aug 2020 22:19:23 +0300
Subject: refactor: create separate Avatar component

---
 src/containers/Profile/ProfileInfo.tsx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'src/containers/Profile/ProfileInfo.tsx')

diff --git a/src/containers/Profile/ProfileInfo.tsx b/src/containers/Profile/ProfileInfo.tsx
index 9eee4c1..a01c222 100644
--- a/src/containers/Profile/ProfileInfo.tsx
+++ b/src/containers/Profile/ProfileInfo.tsx
@@ -1,5 +1,5 @@
 import React, { useState } from 'react';
-import { Avatar, Badge, Typography } from '@material-ui/core/';
+import { Badge, Typography } from '@material-ui/core/';
 import { makeStyles } from '@material-ui/core/styles';
 import { User } from 'which-types';
 import CameraAltIcon from '@material-ui/icons/CameraAlt';
@@ -8,9 +8,11 @@ import Skeleton from '@material-ui/lab/Skeleton';
 import MoreMenu from './MoreMenu';
 import Highlight from './Highlight';
 import UploadImage from '../../components/UploadImage/UploadImage';
+import Avatar from '../../components/Avatar/Avatar';
 import { patch } from '../../requests';
 import { useAuth } from '../../hooks/useAuth';
 
+
 interface PropTypes {
   savedPolls: number;
   totalVotes: number;
@@ -116,19 +118,20 @@ const ProfileInfo: React.FC<PropTypes> = ({
                       vertical: 'bottom',
                       horizontal: 'right'
                     }}
+                    onClick={handleClick}
                     badgeContent={(
                       <div className={classes.badge}>
-                        <CameraAltIcon onClick={handleClick} />
+                        <CameraAltIcon />
                       </div>
                     )}
                   >
-                    <Avatar className={classes.avatar} src={userInfo?.avatarUrl} />
+                    <Avatar className={classes.avatar} user={userInfo} />
                   </Badge>
                 </div>
                 <UploadImage isOpen={input} setIsOpen={setInput} callback={patchAvatar} />
               </div>
             )
-            : <Avatar className={classes.avatar} src={userInfo?.avatarUrl} />
+            : <Avatar className={classes.avatar} user={userInfo} />
       }
       {
         !userInfo
-- 
cgit v1.2.3

