aboutsummaryrefslogtreecommitdiff
path: root/src/components/PollCard/PercentageBar.tsx
blob: a93d7b48c1085f420ce93f588fb090db294fdf21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import LikeIcon from '@material-ui/icons/Favorite';

interface PropTypes {
  value: number;
  which: 'left' | 'right';
  like: boolean;
}

const useStyles = makeStyles({
  root: {
    position: 'absolute',
    color: 'white',
    top: '86%',
    fontSize: 20,
    textShadow: '0 0 3px black',
    display: 'flex',
    alignItems: 'center'
  },
  left: {
    left: 30
  },
  right: {
    right: 30
  }
});

const PercentageBar: React.FC<PropTypes> = ({ value, which, like }) => {
  const classes = useStyles();

  return (
    <div className={`${classes.root} ${classes[which]}`}>
      {like && <LikeIcon />}
      {`${value}%`}
    </div>
  );
};


export default PercentageBar;