aboutsummaryrefslogtreecommitdiff
path: root/src/PollCard/PollCard.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-07 16:44:29 +0300
committereug-vs <eug-vs@keemail.me>2020-06-07 16:44:29 +0300
commit6153da81564c95f21f01a296dcd21b89f062626d (patch)
tree5d8902f6fc9b9ef41a732bdd85625be28d4ae00a /src/PollCard/PollCard.tsx
parent48ece125761c4dce8175265c3b4de717a249eb0e (diff)
downloadwhich-ui-6153da81564c95f21f01a296dcd21b89f062626d.tar.gz
feat: move Poll type to separate file :label:
Diffstat (limited to 'src/PollCard/PollCard.tsx')
-rw-r--r--src/PollCard/PollCard.tsx21
1 files changed, 3 insertions, 18 deletions
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<PercentageBarPropTypes> = ({ value, which }) => {
};
-const PollCard: React.FC<PropTypes> = ({ author, contents: { left, right } }) => {
+const PollCard: React.FC<Poll> = ({ 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<PropTypes> = ({ author, contents: { left, right } }) =>
</Card>
);
};
+
export default PollCard;