diff options
author | ilyayudovin <46264063+ilyayudovin@users.noreply.github.com> | 2020-09-17 18:20:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 18:20:29 +0300 |
commit | 08802fc982328b3c99cc4d4c2a0bec8eeea4c8dc (patch) | |
tree | 87c48171cf2c0d0a86293cb4e1e90b851a3d5300 /src | |
parent | 48a12ab8616e36a5bc853350a8a74b6be897bbd0 (diff) | |
parent | 9f6aa186dec2f77753f713ec2f534f83ce2c49ca (diff) | |
download | which-ui-08802fc982328b3c99cc4d4c2a0bec8eeea4c8dc.tar.gz |
Merge pull request #98 from which-ecosystem/darkenAvatar
Darken avatar
Diffstat (limited to 'src')
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 9 | ||||
-rw-r--r-- | src/containers/Profile/ProfileInfo.tsx | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index 80a1386..540679f 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -52,7 +52,7 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => { const { isAuthenticated } = useAuth(); const date: string = new Date(poll.createdAt).toLocaleString('default', DATE_FORMAT); - const handleVote = (which: Which) => { + const handleVote = (which: Which) => () => { if (!isAuthenticated) { enqueueSnackbar('Unauthorized users can not vote in polls', { variant: 'error' @@ -77,9 +77,6 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => { } }; - const handleLeft = () => handleVote('left'); - const handleRight = () => handleVote('right'); - let leftPercentage; let rightPercentage; @@ -97,11 +94,11 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => { <Card elevation={3}> <UserStrip user={author} info={date} /> <div className={classes.media}> - <CardActionArea onDoubleClick={handleLeft} className={classes.media}> + <CardActionArea onDoubleClick={handleVote('left')} className={classes.media}> <BackgroundImage src={left.url} /> <PercentageBar value={leftPercentage} which="left" like={vote?.which === 'left'} /> </CardActionArea> - <CardActionArea onDoubleClick={handleRight} className={classes.media}> + <CardActionArea onDoubleClick={handleVote('right')} className={classes.media}> <BackgroundImage src={right.url} /> <PercentageBar value={rightPercentage} which="right" like={vote?.which === 'right'} /> </CardActionArea> diff --git a/src/containers/Profile/ProfileInfo.tsx b/src/containers/Profile/ProfileInfo.tsx index e2fb0a9..1f5a103 100644 --- a/src/containers/Profile/ProfileInfo.tsx +++ b/src/containers/Profile/ProfileInfo.tsx @@ -27,8 +27,12 @@ const useStyles = makeStyles(theme => ({ avatar: { width: 150, height: 150, + position: 'relative', margin: '0 auto' }, + darken: { + filter: 'brightness(50%)' + }, name: { margin: theme.spacing(1, 0), display: 'flex', @@ -129,7 +133,7 @@ const ProfileInfo: React.FC<PropTypes> = ({ </FileUpload> )} > - <Avatar className={classes.avatar} user={userInfo} /> + <Avatar className={[classes.avatar, progress && classes.darken].join(' ')} user={userInfo} /> {progress > 0 && ( <CircularProgress variant="static" value={progress} className={classes.progress} /> )} |