From f0d1821aea8490689fde973630757588a58bd7cb Mon Sep 17 00:00:00 2001 From: wildscotsmen Date: Thu, 25 Oct 2018 22:46:36 -0400 Subject: [PATCH] Added toast to report form. --- src/components/ReportForm.js | 56 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/components/ReportForm.js b/src/components/ReportForm.js index 9815843..7d50473 100644 --- a/src/components/ReportForm.js +++ b/src/components/ReportForm.js @@ -4,6 +4,10 @@ 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 CheckCircleIcon from '@material-ui/icons/CheckCircle'; +import Snackbar from '@material-ui/core/Snackbar'; +import IconButton from '@material-ui/core/IconButton'; +import CloseIcon from '@material-ui/icons/Close'; import Button from '@material-ui/core/Button'; import firebase from '../firebase.js'; import GoogleMap from '../components/ReportMap'; @@ -33,6 +37,17 @@ const styles = theme => ({ dense: { marginTop: 30, }, + close: { + padding: theme.spacing.unit / 2, + }, + icon: { + fontSize: 20, + marginRight: theme.spacing.unit, + }, + message: { + display: 'flex', + alignItems: 'center', + }, menu: { width: 200, }, @@ -220,7 +235,8 @@ class ReportForm extends React.Component { confidence: '1', desc: '', lat: '', - lng: '' + lng: '', + open: false }; /** @@ -233,6 +249,17 @@ class ReportForm extends React.Component { }); }; + /** + * Handles closing the toast. + */ + handleClose = (event, reason) => { + if (reason === 'clickaway') { + return; + } + + this.setState({ open: false }); + }; + /* * Get the coordinates * @@ -274,7 +301,8 @@ class ReportForm extends React.Component { confidence: '1', desc: '', lat: '', - lng: '' + lng: '', + open: true }); }; @@ -440,6 +468,30 @@ class ReportForm extends React.Component { + Report received.} + action={[ + + + , + ]} + /> ); }