From 1bf51552d725629f0c38c77edf07eb20e1a9c254 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Tue, 26 Jun 2018 16:34:52 -0400 Subject: [PATCH] add AddPoll component --- app/components/Voting.js | 2 + app/components/simple-voting/AddPoll.js | 72 +++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 app/components/simple-voting/AddPoll.js diff --git a/app/components/Voting.js b/app/components/Voting.js index 3f0abbc..b027028 100644 --- a/app/components/Voting.js +++ b/app/components/Voting.js @@ -2,10 +2,12 @@ import React, { Fragment } from 'react'; import CssBaseline from '@material-ui/core/CssBaseline'; import 'typeface-roboto'; import AppBar from './standard/AppBar'; +import AddPoll from './simple-voting/AddPoll'; export default ({ toggleAdmin }) => ( + ) diff --git a/app/components/simple-voting/AddPoll.js b/app/components/simple-voting/AddPoll.js new file mode 100644 index 0000000..d62c220 --- /dev/null +++ b/app/components/simple-voting/AddPoll.js @@ -0,0 +1,72 @@ +import React, { Fragment } from 'react'; +import Card from '@material-ui/core/Card'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +import PollManager from 'Embark/contracts/PollManager'; +import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +import { withStyles } from '@material-ui/core/styles'; +import { withFormik } from 'formik'; + +const styles = theme => ({ + button: { + margin: theme.spacing.unit, + }, + extendedIcon: { + marginRight: theme.spacing.unit, + }, + textField: { + marginLeft: theme.spacing.unit, + marginRight: theme.spacing.unit + }, + inputLabel: { + fontSize: '16px' + }, + form: { + display: 'flex', + flexDirection: 'column' + } +}); + +const InnerForm = ({ + values, + errors, + touched, + handleChange, + handleBlur, + handleSubmit, + isSubmitting, + classes +}) => ( + + +
+ + + +
+
+) + +const StyledForm = withStyles(styles)(InnerForm); +const AddPoll = withFormik({ + mapPropsToValues: props => ({ description: ''}), + validate(values){ + const errors = {}; + return errors; + }, + handleSubmit(values) { + + } +})(StyledForm) + +export default AddPoll;