Merge branch '000-snt-voting-dapp' of https://github.com/status-im/contracts into 000-snt-voting-dapp
This commit is contained in:
commit
818b67d19f
|
@ -2,10 +2,12 @@ import React, { Fragment } from 'react';
|
||||||
import CssBaseline from '@material-ui/core/CssBaseline';
|
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||||
import 'typeface-roboto';
|
import 'typeface-roboto';
|
||||||
import AppBar from './standard/AppBar';
|
import AppBar from './standard/AppBar';
|
||||||
|
import AddPoll from './simple-voting/AddPoll';
|
||||||
|
|
||||||
export default ({ toggleAdmin }) => (
|
export default ({ toggleAdmin }) => (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<AppBar toggleAdmin={toggleAdmin} />
|
<AppBar toggleAdmin={toggleAdmin} />
|
||||||
|
<AddPoll />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
|
|
|
@ -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
|
||||||
|
}) => (
|
||||||
|
<Card>
|
||||||
|
<CardContent>
|
||||||
|
<form onSubmit={handleSubmit} className={classes.form}>
|
||||||
|
<TextField
|
||||||
|
id="description"
|
||||||
|
label="description"
|
||||||
|
className={classes.textField}
|
||||||
|
value={values.description}
|
||||||
|
onChange={handleChange}
|
||||||
|
margin="normal"
|
||||||
|
fullWidth
|
||||||
|
error={errors.description}
|
||||||
|
/>
|
||||||
|
<Button type="submit" variant="extendedFab" aria-label="add" className={classes.button}>Submit</Button>
|
||||||
|
</form>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)
|
||||||
|
|
||||||
|
const StyledForm = withStyles(styles)(InnerForm);
|
||||||
|
const AddPoll = withFormik({
|
||||||
|
mapPropsToValues: props => ({ description: ''}),
|
||||||
|
validate(values){
|
||||||
|
const errors = {};
|
||||||
|
return errors;
|
||||||
|
},
|
||||||
|
handleSubmit(values) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})(StyledForm)
|
||||||
|
|
||||||
|
export default AddPoll;
|
Loading…
Reference in New Issue