diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-10-08 13:58:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-08 13:58:18 +0300 |
commit | 45b4094c02301ff854b8b8017437ad9989efa117 (patch) | |
tree | 0c7c375a24519fdff596f8377e2a131b98d2501e /src/containers/PollCreation | |
parent | c3f9271adebf37ed66664d978cfae2a6b327ebff (diff) | |
parent | 80a09a9ec176c7585dca9d81f6b3d690660ce633 (diff) | |
download | which-ui-45b4094c02301ff854b8b8017437ad9989efa117.tar.gz |
Merge pull request #101 from which-ecosystem/feat/modal
ModalScreen component
Diffstat (limited to 'src/containers/PollCreation')
-rw-r--r-- | src/containers/PollCreation/PollCreation.tsx | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx index ecc6757..b7ee00a 100644 --- a/src/containers/PollCreation/PollCreation.tsx +++ b/src/containers/PollCreation/PollCreation.tsx @@ -5,7 +5,6 @@ import { makeStyles } from '@material-ui/core/styles'; import { Button, Card, - Divider, Container, LinearProgress } from '@material-ui/core'; @@ -13,16 +12,14 @@ import { useSnackbar } from 'notistack'; import useS3Preupload from './useS3Preupload'; import ImageInput from './ImageInput'; +import ModalScreen from '../../components/ModalScreen/ModalScreen'; import UserStrip from '../../components/UserStrip/UserStrip'; import { post } from '../../requests'; -import { useAuth } from '../../hooks/useAuth'; import { useFeed } from '../../hooks/APIClient'; +import { useAuth } from '../../hooks/useAuth'; const useStyles = makeStyles(theme => ({ - root: { - marginBottom: theme.spacing(4) - }, images: { height: theme.spacing(50), display: 'flex' @@ -33,8 +30,8 @@ const useStyles = makeStyles(theme => ({ const PollCreation: React.FC = () => { const classes = useStyles(); const history = useHistory(); - const { enqueueSnackbar } = useSnackbar(); const { user } = useAuth(); + const { enqueueSnackbar } = useSnackbar(); const { mutate: updateFeed } = useFeed(); const { file: left, @@ -71,31 +68,32 @@ const PollCreation: React.FC = () => { }; return ( - <Container maxWidth="sm" disableGutters> - <Card className={classes.root}> - {user && <UserStrip user={user} info="" />} - <Divider /> - <div className={classes.images}> - <ImageInput callback={setLeft} progress={leftProgress} /> - <ImageInput callback={setRight} progress={rightProgress} /> - </div> - { - leftProgress || rightProgress - ? <LinearProgress color="primary" /> - : ( - <Button - color="primary" - disabled={!(left && right)} - variant="contained" - onClick={handleClick} - fullWidth - > - Submit - </Button> - ) - } - </Card> - </Container> + <ModalScreen title="Create a poll"> + <Container maxWidth="sm" disableGutters> + <Card elevation={3}> + {user && <UserStrip user={user} info="" />} + <div className={classes.images}> + <ImageInput callback={setLeft} progress={leftProgress} /> + <ImageInput callback={setRight} progress={rightProgress} /> + </div> + { + leftProgress || rightProgress + ? <LinearProgress color="primary" /> + : ( + <Button + color="primary" + disabled={!(left && right)} + variant="contained" + onClick={handleClick} + fullWidth + > + Submit + </Button> + ) + } + </Card> + </Container> + </ModalScreen> ); }; |