From 5ff3d0a3a29ebba9c42603369bb16d7419a423d1 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 7 Jun 2020 20:10:39 +0300 Subject: fix: change props again --- src/Feed/Feed.tsx | 2 +- src/PollCard/PollCard.tsx | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Feed/Feed.tsx b/src/Feed/Feed.tsx index ef82b38..e5bc9aa 100644 --- a/src/Feed/Feed.tsx +++ b/src/Feed/Feed.tsx @@ -20,7 +20,7 @@ const Feed: React.FC = ({ polls }) => { return (
{ - polls.map(poll => ) + polls.map(poll => ) }
); diff --git a/src/PollCard/PollCard.tsx b/src/PollCard/PollCard.tsx index e2ca518..588714a 100644 --- a/src/PollCard/PollCard.tsx +++ b/src/PollCard/PollCard.tsx @@ -9,6 +9,10 @@ import { } from '@material-ui/core/'; import { Poll } from '../types'; +interface PropTypes { + poll: Poll; +} + interface PercentageBarPropTypes { value: number; which: 'left' | 'right'; @@ -55,34 +59,36 @@ const PercentageBar: React.FC = ({ value, which }) => { }; -const PollCard: React.FC = (Poll) => { +const PollCard: React.FC = ({ poll }) => { const classes = useStyles(); + const { author, contents } = poll; - const leftPercentage = Math.round(100 * (Poll.contents.left.votes / (Poll.contents.left.votes + Poll.contents.right.votes))); + const leftPercentage = Math.round(100 * (contents.left.votes / (contents.left.votes + contents.right.votes))); const rightPercentage = 100 - leftPercentage; + return ( - {Poll.author.name[0].toUpperCase()} + {author.name[0].toUpperCase()} )} - title={Poll.author.name} + title={author.name} />
-- cgit v1.2.3