diff --git a/src/components/ReportForm.js b/src/components/ReportForm.js index cab0f04..b380827 100644 --- a/src/components/ReportForm.js +++ b/src/components/ReportForm.js @@ -1,19 +1,31 @@ import React from 'react'; import PropTypes from 'prop-types'; -// import classNames from 'classnames'; +import Grid from '@material-ui/core/Grid'; import { withStyles } from '@material-ui/core/styles'; import MenuItem from '@material-ui/core/MenuItem'; import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +/** + * Styles that the different + * Material UI components pull + * in. Mostly used for spacing. + */ const styles = theme => ({ container: { display: 'flex', flexWrap: 'wrap', }, textField: { - marginLeft: theme.spacing.unit, + marginLeft: theme.spacing.unit * 2, marginRight: theme.spacing.unit, - marginTop: theme.spacing.unit, + marginTop: theme.spacing.unit * 2, + flexBasis: 280, + }, + button: { + marginLeft: theme.spacing.unit * 2, + marginRight: theme.spacing.unit, + marginTop: theme.spacing.unit * 2, }, dense: { marginTop: 30, @@ -23,6 +35,14 @@ const styles = theme => ({ }, }); +/** + * Function for formatting the + * date as a string that + * Material UI can use. We'll + * also store the date like + * this string in the database. + * @param {*} date, Date passed in. + */ function formatDate(date) { var d = new Date(date), month = '' + (d.getMonth() + 1), @@ -95,109 +115,150 @@ const confidenceLevels = [ }, ]; +/** + * The form compnent. + */ class ReportForm extends React.Component { + /** + * State of form components. + */ state = { date: formatDate(new Date()), time: '00:00', - multiline: 'Controlled', type: '', confidence: '' }; + /** + * Handles state change in form + * components. + */ handleChange = name => event => { this.setState({ [name]: event.target.value, }); }; + /** + * The render method for this component. + */ render() { const { classes } = this.props; + /** + * The actual form. + */ return ( -
- - {sightingTypes.map(option => ( - - {option.label} - - ))} - + + + + + {sightingTypes.map(option => ( + + {option.label} + + ))} + + - - {confidenceLevels.map(option => ( - - {option.label} - - ))} - + + + {confidenceLevels.map(option => ( + + {option.label} + + ))} + + - + + + - - + + + + + + + + + + + +
); } diff --git a/src/pages/Report.js b/src/pages/Report.js index 3a46a74..8a7909d 100644 --- a/src/pages/Report.js +++ b/src/pages/Report.js @@ -5,7 +5,7 @@ import Typography from '@material-ui/core/Typography'; class Report extends Component { render() { return ( - + );