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/components | |
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/components')
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 9 |
1 files changed, 3 insertions, 6 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> |