diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-25 21:37:38 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-25 21:37:38 +0300 |
commit | cb88b8fde92772c5de4eb36cea88c69d7a879d93 (patch) | |
tree | c6354b376987523690e990881c81c02ef01088c0 | |
parent | 9dfc98d5014f91afb45ad4eebbe9f0f704ddfdf5 (diff) | |
download | which-ui-cb88b8fde92772c5de4eb36cea88c69d7a879d93.tar.gz |
feat: add icon for uploading avatar photo
-rw-r--r-- | src/pages/ProfilePage/ProfileInfo.tsx | 39 |
1 files changed, 34 insertions, 5 deletions
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> |