From cb88b8fde92772c5de4eb36cea88c69d7a879d93 Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Thu, 25 Jun 2020 21:37:38 +0300
Subject: feat: add icon for uploading avatar photo

---
 src/pages/ProfilePage/ProfileInfo.tsx | 39 ++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)

(limited to 'src/pages/ProfilePage/ProfileInfo.tsx')

diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx
index 7208ec8..2d2c67b 100644
--- a/src/pages/ProfilePage/ProfileInfo.tsx
+++ b/src/pages/ProfilePage/ProfileInfo.tsx
@@ -1,8 +1,9 @@
 import React from 'react';
-import { Avatar } from '@material-ui/core/';
+import {Avatar, Badge, withStyles} from '@material-ui/core/';
 import { makeStyles } from '@material-ui/core/styles';
 import Button from '@material-ui/core/Button/Button';
 import { User } from 'which-types';
+import CameraAltIcon from '@material-ui/icons/CameraAlt';
 
 interface PropTypes {
   user: User | undefined;
@@ -11,14 +12,13 @@ interface PropTypes {
 
 const useStyles = makeStyles({
   avatar: {
-    margin: '0 auto',
     width: 150,
     height: 150,
-    marginBottom: 10
   },
   name: {
     fontSize: 20,
-    textAlign: 'center'
+    textAlign: 'center',
+    margin: '10px 0'
   },
   profileMenu: {
     display: 'flex',
@@ -32,14 +32,43 @@ const useStyles = makeStyles({
     height: 50,
     paddingTop: 15,
     textAlign: 'center'
+  },
+  badge: {
+    backgroundColor: 'lightgray'
+  },
+  avatarContainer: {
+    position: 'relative',
+    textAlign: 'center'
   }
 });
 
+
+const StyledBadge = withStyles((theme) => ({
+  badge: {
+    backgroundColor: 'lightgray',
+    width: 40,
+    height: 40,
+    borderRadius: '50%',
+    cursor: 'pointer'
+  },
+}))(Badge);
+
 const ProfileInfo: React.FC<PropTypes> = ({ user, logOut }) => {
   const classes = useStyles();
   return (
     <div>
-      <Avatar className={classes.avatar} src={user?.avatarUrl} />
+      <div className={classes.avatarContainer}>
+        <StyledBadge
+          overlap="circle"
+          anchorOrigin={{
+            vertical: 'bottom',
+            horizontal: 'right',
+          }}
+          badgeContent={<CameraAltIcon />}
+         >
+          <Avatar className={classes.avatar} src={user?.avatarUrl} />
+        </StyledBadge>
+      </div>
       <div className={classes.name}>
         {user?.username}
       </div>
-- 
cgit v1.2.3

