aboutsummaryrefslogtreecommitdiff
path: root/src/containers
diff options
context:
space:
mode:
authorilyayudovin <ilyayudovin123@gmail.com>2020-09-15 00:15:30 +0300
committereug-vs <eug-vs@keemail.me>2020-10-08 22:01:50 +0300
commit0a23633aa49ece18897a6ceaa56fdd3cd837b8e8 (patch)
treef91366bf055f50afe5ea5d30bb4a63e6f33c0183 /src/containers
parentbdb4d194307c9755c2083c1a11bb876abebcb6de (diff)
downloadwhich-ui-0a23633aa49ece18897a6ceaa56fdd3cd837b8e8.tar.gz
feat: add description to poll
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/Page/Page.tsx3
-rw-r--r--src/containers/PollCreation/PollCreation.tsx13
2 files changed, 10 insertions, 6 deletions
diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index e60f7da..9a904a4 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -17,7 +17,8 @@ const useStyles = makeStyles(theme => ({
},
[theme.breakpoints.up('md')]: {
padding: theme.spacing(15, 5, 8, 5)
- }
+ },
+ backgroundColor: 'whitesmoke'
}
}));
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx
index 68f41d2..7f29119 100644
--- a/src/containers/PollCreation/PollCreation.tsx
+++ b/src/containers/PollCreation/PollCreation.tsx
@@ -1,7 +1,7 @@
-import React from 'react';
+import React, {useRef} from 'react';
import Bluebird from 'bluebird';
import { makeStyles } from '@material-ui/core/styles';
-import { Card, Container, LinearProgress } from '@material-ui/core';
+import { Card, Container, LinearProgress, Divider } from '@material-ui/core';
import SendIcon from '@material-ui/icons/Send';
import { useSnackbar } from 'notistack';
@@ -25,8 +25,9 @@ const useStyles = makeStyles(theme => ({
const PollCreation: React.FC = () => {
const classes = useStyles();
- const { user } = useAuth();
+ const ref = useRef<HTMLTextAreaElement>(null);
const { enqueueSnackbar } = useSnackbar();
+ const { user } = useAuth();
const { mutate: updateFeed } = useFeed();
const { mutate: updateProfile } = useProfile(user?.username || '');
const {
@@ -50,8 +51,8 @@ const PollCreation: React.FC = () => {
left: { url: leftUrl },
right: { url: rightUrl }
};
-
- post('/polls/', { contents }).then(() => {
+ const description = ref?.current?.value;
+ post('/polls/', { contents, description }).then(() => {
updateFeed();
updateProfile();
enqueueSnackbar('Your poll has been successfully created!', { variant: 'success' });
@@ -71,6 +72,8 @@ const PollCreation: React.FC = () => {
<Container maxWidth="sm" disableGutters>
<Card elevation={3}>
{user && <UserStrip user={user} info="" />}
+ <Divider />
+ <textarea ref={ref} />
<div className={classes.images}>
<ImageInput callback={setLeft} progress={leftProgress} />
<ImageInput callback={setRight} progress={rightProgress} />