aboutsummaryrefslogtreecommitdiff
path: root/src/containers
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-10-07 23:51:45 +0300
committereug-vs <eug-vs@keemail.me>2020-10-07 23:51:45 +0300
commita283d4310c11f03fe9ff889c6274798b70cf6a19 (patch)
tree8c21d1ea50d615a466ddd88143bde274abf14256 /src/containers
parent4471fef74dfe312a8cf6a1440f5a703e897af136 (diff)
downloadwhich-ui-a283d4310c11f03fe9ff889c6274798b70cf6a19.tar.gz
feat: create ModalScreen component
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/Page/Page.tsx6
-rw-r--r--src/containers/PollCreation/PollCreation.tsx58
2 files changed, 27 insertions, 37 deletions
diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index 51b6d21..b7e1938 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -36,11 +36,7 @@ const Page: React.FC = () => {
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
useEffect(() => history.listen((update: HistoryChange) => {
- console.log(update)
- if (!update.state?.background) {
- console.log('scrolling')
- window.scrollTo(0, 0);
- }
+ if (!update.state?.background) window.scrollTo(0, 0);
}), [history]);
return (
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx
index ecc6757..079c79f 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,12 @@ import { useSnackbar } from 'notistack';
import useS3Preupload from './useS3Preupload';
import ImageInput from './ImageInput';
-import UserStrip from '../../components/UserStrip/UserStrip';
+import ModalScreen from '../../components/ModalScreen/ModalScreen';
import { post } from '../../requests';
-import { useAuth } from '../../hooks/useAuth';
import { useFeed } from '../../hooks/APIClient';
const useStyles = makeStyles(theme => ({
- root: {
- marginBottom: theme.spacing(4)
- },
images: {
height: theme.spacing(50),
display: 'flex'
@@ -34,7 +29,6 @@ const PollCreation: React.FC = () => {
const classes = useStyles();
const history = useHistory();
const { enqueueSnackbar } = useSnackbar();
- const { user } = useAuth();
const { mutate: updateFeed } = useFeed();
const {
file: left,
@@ -71,31 +65,31 @@ 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>
+ <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>
);
};