From 9e9c18cd1d02a0185d0387770a7bafc18020d6c0 Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Fri, 26 Jun 2020 03:03:33 +0300
Subject: display user avatar instead avatarIcon in header

---
 src/components/Header/Header.tsx | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'src/components/Header/Header.tsx')

diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx
index 4e25fa3..eb24ecc 100644
--- a/src/components/Header/Header.tsx
+++ b/src/components/Header/Header.tsx
@@ -3,7 +3,7 @@ import {
   AppBar,
   Toolbar,
   IconButton,
-  Typography
+  Typography, Avatar
 } from '@material-ui/core';
 import { makeStyles } from '@material-ui/core/styles';
 import AccountCircle from '@material-ui/icons/AccountCircle';
@@ -13,6 +13,7 @@ import HomeIcon from '@material-ui/icons/Home';
 import SearchBar from './SearchBar';
 
 interface PropTypes {
+  userImage: string | undefined;
   navigate: (prefix: string) => void;
 }
 
@@ -25,10 +26,14 @@ const useStyles = makeStyles({
   },
   logo: {
     fontWeight: 'bold'
+  },
+  avatar:{
+    width: 24,
+    height: 24
   }
 });
 
-const Header: React.FC<PropTypes> = ({ navigate }) => {
+const Header: React.FC<PropTypes> = ({ navigate, userImage }) => {
   const classes = useStyles();
 
   const handleHome = (): void => {
@@ -56,7 +61,11 @@ const Header: React.FC<PropTypes> = ({ navigate }) => {
             <NotificationsIcon />
           </IconButton>
           <IconButton onClick={handleProfile}>
-            <AccountCircle />
+            {
+              localStorage.getItem('token')
+                ? <Avatar className={classes.avatar} src={userImage}/>
+                : <AccountCircle />
+            }
           </IconButton>
         </div>
       </Toolbar>
-- 
cgit v1.2.3


From a5fbcc34f2529a2429124572915597c0fed45ae7 Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Fri, 26 Jun 2020 19:07:37 +0300
Subject: show avatar in header only if user set an avatar image

---
 src/components/Header/Header.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/Header/Header.tsx')

diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx
index eb24ecc..a5e6817 100644
--- a/src/components/Header/Header.tsx
+++ b/src/components/Header/Header.tsx
@@ -62,7 +62,7 @@ const Header: React.FC<PropTypes> = ({ navigate, userImage }) => {
           </IconButton>
           <IconButton onClick={handleProfile}>
             {
-              localStorage.getItem('token')
+              userImage!== undefined
                 ? <Avatar className={classes.avatar} src={userImage}/>
                 : <AccountCircle />
             }
-- 
cgit v1.2.3


From 5b08023e0aa0e626264673ebb86dc82299a3b54b Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 27 Jun 2020 19:15:41 +0300
Subject: style: fix ALL linting errors

---
 src/components/Header/Header.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/components/Header/Header.tsx')

diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx
index a5e6817..2e3fc20 100644
--- a/src/components/Header/Header.tsx
+++ b/src/components/Header/Header.tsx
@@ -27,7 +27,7 @@ const useStyles = makeStyles({
   logo: {
     fontWeight: 'bold'
   },
-  avatar:{
+  avatar: {
     width: 24,
     height: 24
   }
@@ -62,8 +62,8 @@ const Header: React.FC<PropTypes> = ({ navigate, userImage }) => {
           </IconButton>
           <IconButton onClick={handleProfile}>
             {
-              userImage!== undefined
-                ? <Avatar className={classes.avatar} src={userImage}/>
+              userImage !== undefined
+                ? <Avatar className={classes.avatar} src={userImage} />
                 : <AccountCircle />
             }
           </IconButton>
-- 
cgit v1.2.3

