From 63d8c7cfdc941896e54071f2dce2274d1b602245 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 7 Jun 2020 19:27:32 +0300 Subject: fix: changing px to spacing --- src/PollCard/PollCard.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/PollCard') diff --git a/src/PollCard/PollCard.tsx b/src/PollCard/PollCard.tsx index 07449fb..27a37a2 100644 --- a/src/PollCard/PollCard.tsx +++ b/src/PollCard/PollCard.tsx @@ -14,15 +14,15 @@ interface PercentageBarPropTypes { which: 'left' | 'right'; } -const useStyles = makeStyles({ +const useStyles = makeStyles(theme => ({ root: { - maxWidth: 600, - height: 500, + maxWidth: theme.spacing(75), + height: theme.spacing(63), margin: '20px auto' }, images: { - height: 400, - width: 300 + height: theme.spacing(50), + width: theme.spacing(38) }, imagesBlock: { display: 'flex' @@ -39,7 +39,7 @@ const useStyles = makeStyles({ percentageRight: { right: 30 } -}); +})); const PercentageBar: React.FC = ({ value, which }) => { -- cgit v1.2.3 From 9af3ee7da28c3acbd434602592c517b025d93252 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 7 Jun 2020 19:46:21 +0300 Subject: fix: change Poll props --- src/PollCard/PollCard.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/PollCard') 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 = ({ value, which }) => { }; -const PollCard: React.FC = ({ author, contents: { left, right } }) => { +const PollCard: React.FC = (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 = ({ author, contents: { left, right } }) => { - {author.name[0].toUpperCase()} + {Poll.author.name[0].toUpperCase()} )} - title={author.name} + title={Poll.author.name} />
-- cgit v1.2.3 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/PollCard/PollCard.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/PollCard') 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