From eb9716d39b6932b2990ab33c59214e1f276a3c68 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 25 Jun 2020 15:29:40 +0300 Subject: feat: transition rateline nicely --- src/components/PollCard/PollCard.tsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index 40f5fd7..65b3da1 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -37,11 +37,15 @@ const useStyles = makeStyles(theme => ({ position: 'relative', width: '100%', height: theme.spacing(2), - backgroundColor: theme.palette.primary.light + backgroundColor: theme.palette.primary.light, + transitionDuration: '0.5s' + }, + highlight: { + backgroundColor: theme.palette.primary.main + ' !important' }, fillRateLine: { height: theme.spacing(2), - backgroundColor: theme.palette.primary.main, + backgroundColor: theme.palette.primary.light, transitionDuration: '0.5s' } })); @@ -68,11 +72,8 @@ const PollCard: React.FC = ({ initialPoll, navigate }) => { const handleRight = () => vote('right'); const leftPercentage = Math.round(100 * (left.votes / (left.votes + right.votes))); + const rightPercentage = 100 - leftPercentage - const percentage = { - left: leftPercentage, - right: 100 - leftPercentage - }; const dominant: Which = left.votes >= right.votes ? 'left' : 'right'; return ( @@ -95,23 +96,20 @@ const PollCard: React.FC = ({ initialPoll, navigate }) => { className={classes.images} image={left.url} /> - + - + -
+
-- cgit v1.2.3