From 6153da81564c95f21f01a296dcd21b89f062626d Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 7 Jun 2020 16:44:29 +0300 Subject: feat: move Poll type to separate file :label: --- src/PollCard/PollCard.tsx | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/PollCard/PollCard.tsx') diff --git a/src/PollCard/PollCard.tsx b/src/PollCard/PollCard.tsx index ee81b7d..07449fb 100644 --- a/src/PollCard/PollCard.tsx +++ b/src/PollCard/PollCard.tsx @@ -7,29 +7,13 @@ import { Avatar, CardHeader } from '@material-ui/core/'; - -interface ImageData { - url: string; - votes: number; -} - -interface PropTypes { - author: { - name: string; - avatarUrl: string; - }; - contents: { - left: ImageData; - right: ImageData; - }; -} +import { Poll } from '../types'; interface PercentageBarPropTypes { value: number; which: 'left' | 'right'; } - const useStyles = makeStyles({ root: { maxWidth: 600, @@ -71,7 +55,7 @@ const PercentageBar: React.FC = ({ value, which }) => { }; -const PollCard: React.FC = ({ author, contents: { left, right } }) => { +const PollCard: React.FC = ({ author, contents: { left, right } }) => { const classes = useStyles(); const leftPercentage = Math.round(100 * (left.votes / (left.votes + right.votes))); @@ -106,5 +90,6 @@ const PollCard: React.FC = ({ author, contents: { left, right } }) => ); }; + export default PollCard; -- cgit v1.2.3