aboutsummaryrefslogtreecommitdiff
path: root/src/pages/FeedPage/PollSubmission.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/FeedPage/PollSubmission.tsx')
-rw-r--r--src/pages/FeedPage/PollSubmission.tsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pages/FeedPage/PollSubmission.tsx b/src/pages/FeedPage/PollSubmission.tsx
index 18f029c..347eecc 100644
--- a/src/pages/FeedPage/PollSubmission.tsx
+++ b/src/pages/FeedPage/PollSubmission.tsx
@@ -8,6 +8,7 @@ import {
Divider
} from '@material-ui/core';
import { Poll, Which } from 'which-types';
+import { useSnackbar } from 'notistack';
import PollSubmissionImage from './PollSubmissionImage';
import UserStrip from '../../components/UserStrip/UserStrip';
import { post } from '../../requests';
@@ -20,6 +21,9 @@ interface PropTypes{
const useStyles = makeStyles(theme => ({
root: {
+ marginBottom: theme.spacing(4)
+ },
+ images: {
height: theme.spacing(50),
display: 'flex'
}
@@ -34,6 +38,7 @@ const PollSubmission: React.FC<PropTypes> = ({ addPoll }) => {
const classes = useStyles();
const [expanded, setExpanded] = useState(false);
const [contents, setContents] = useState<Contents>(emptyContents);
+ const { enqueueSnackbar } = useSnackbar();
const { user } = useAuth();
const readyToSubmit = contents.left.url && contents.right.url;
@@ -50,6 +55,9 @@ const PollSubmission: React.FC<PropTypes> = ({ addPoll }) => {
if (expanded && readyToSubmit) {
post('/polls/', { contents }).then(response => {
addPoll(response.data);
+ enqueueSnackbar('Your poll has been successfully created!', {
+ variant: 'success'
+ });
});
setContents({ ...emptyContents });
}
@@ -58,11 +66,11 @@ const PollSubmission: React.FC<PropTypes> = ({ addPoll }) => {
return (
<ClickAwayListener onClickAway={handleClickAway}>
- <Card>
+ <Card className={classes.root}>
<Collapse in={expanded} timeout="auto" unmountOnExit>
{user && <UserStrip user={user} info="" />}
<Divider />
- <div className={classes.root}>
+ <div className={classes.images}>
<PollSubmissionImage url={contents.left.url} setUrl={setUrl('left')} />
<PollSubmissionImage url={contents.right.url} setUrl={setUrl('right')} />
</div>