diff options
-rw-r--r-- | src/components/ModalScreen/ModalScreen.tsx | 46 | ||||
-rw-r--r-- | src/containers/PollCreation/PollCreation.tsx | 6 |
2 files changed, 41 insertions, 11 deletions
diff --git a/src/components/ModalScreen/ModalScreen.tsx b/src/components/ModalScreen/ModalScreen.tsx index 6b7c52c..6ffc978 100644 --- a/src/components/ModalScreen/ModalScreen.tsx +++ b/src/components/ModalScreen/ModalScreen.tsx @@ -1,20 +1,36 @@ import React, { useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import { + AppBar, Dialog, Toolbar, Typography, IconButton, + Divider, useMediaQuery, useTheme } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; import CloseIcon from '@material-ui/icons/Close'; interface PropTypes { title: string; } +const useStyles = makeStyles(theme => ({ + root: { + backgroundColor: theme.palette.background.default + }, + content: { + padding: theme.spacing(3, 0, 0, 0) + }, + toolbar: { + display: 'flex', + } +})); + const ModalScreen: React.FC<PropTypes> = ({ title, children }) => { + const classes = useStyles(); const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('sm')); const history = useHistory(); @@ -22,16 +38,26 @@ const ModalScreen: React.FC<PropTypes> = ({ title, children }) => { const handleClose = useCallback(() => history.goBack(), [history]); return ( - <Dialog fullScreen={isMobile} fullWidth open> - <Toolbar color="primary"> - <IconButton edge="start" onClick={handleClose}> - <CloseIcon /> - </IconButton> - <Typography variant="h6"> - { title } - </Typography> - </Toolbar> - { children } + <Dialog + open + PaperProps={{ className: classes.root }} + fullScreen={isMobile} + fullWidth + > + <AppBar position="static"> + <Toolbar className={classes.toolbar}> + <IconButton edge="start" onClick={handleClose}> + <CloseIcon /> + </IconButton> + <Typography variant="h6"> + { title } + </Typography> + </Toolbar> + </AppBar> + <Divider /> + <div className={classes.content}> + { children } + </div> </Dialog> ); }; diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx index 079c79f..b7ee00a 100644 --- a/src/containers/PollCreation/PollCreation.tsx +++ b/src/containers/PollCreation/PollCreation.tsx @@ -13,8 +13,10 @@ 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 { useFeed } from '../../hooks/APIClient'; +import { useAuth } from '../../hooks/useAuth'; const useStyles = makeStyles(theme => ({ @@ -28,6 +30,7 @@ const useStyles = makeStyles(theme => ({ const PollCreation: React.FC = () => { const classes = useStyles(); const history = useHistory(); + const { user } = useAuth(); const { enqueueSnackbar } = useSnackbar(); const { mutate: updateFeed } = useFeed(); const { @@ -67,7 +70,8 @@ const PollCreation: React.FC = () => { return ( <ModalScreen title="Create a poll"> <Container maxWidth="sm" disableGutters> - <Card> + <Card elevation={3}> + {user && <UserStrip user={user} info="" />} <div className={classes.images}> <ImageInput callback={setLeft} progress={leftProgress} /> <ImageInput callback={setRight} progress={rightProgress} /> |