diff options
author | ilyayudovin <ilyayudovin123.@mail.com> | 2020-06-07 19:46:21 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123.@mail.com> | 2020-06-07 19:46:21 +0300 |
commit | 9af3ee7da28c3acbd434602592c517b025d93252 (patch) | |
tree | bebd1156ac8a56a8655506627f8f1bc3ef259d39 | |
parent | 63d8c7cfdc941896e54071f2dce2274d1b602245 (diff) | |
download | which-ui-9af3ee7da28c3acbd434602592c517b025d93252.tar.gz |
fix: change Poll props
-rw-r--r-- | src/PollCard/PollCard.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/PollCard/PollCard.tsx b/src/PollCard/PollCard.tsx index 27a37a2..e2ca518 100644 --- a/src/PollCard/PollCard.tsx +++ b/src/PollCard/PollCard.tsx @@ -55,10 +55,10 @@ const PercentageBar: React.FC<PercentageBarPropTypes> = ({ value, which }) => { }; -const PollCard: React.FC<Poll> = ({ author, contents: { left, right } }) => { +const PollCard: React.FC<Poll> = (Poll) => { const classes = useStyles(); - const leftPercentage = Math.round(100 * (left.votes / (left.votes + right.votes))); + const leftPercentage = Math.round(100 * (Poll.contents.left.votes / (Poll.contents.left.votes + Poll.contents.right.votes))); const rightPercentage = 100 - leftPercentage; return ( @@ -66,23 +66,23 @@ const PollCard: React.FC<Poll> = ({ author, contents: { left, right } }) => { <CardHeader avatar={( <Avatar aria-label="avatar"> - <img src={author.avatarUrl} alt={author.name[0].toUpperCase()} /> + <img src={Poll.author.avatarUrl} alt={Poll.author.name[0].toUpperCase()} /> </Avatar> )} - title={author.name} + title={Poll.author.name} /> <div className={classes.imagesBlock}> <CardActionArea> <CardMedia className={classes.images} - image={left.url} + image={Poll.contents.left.url} /> <PercentageBar value={leftPercentage} which="left" /> </CardActionArea> <CardActionArea> <CardMedia className={classes.images} - image={right.url} + image={Poll.contents.right.url} /> <PercentageBar value={rightPercentage} which="right" /> </CardActionArea> |