diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-08-14 02:50:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-14 02:50:16 +0300 |
commit | dc0d09f568ca9eeda4978c4750b548ba81688c23 (patch) | |
tree | 08dfa96410207f5621989c3cb0ea930624af1bee /src/containers/Page | |
parent | 6ace75beae6ab6a466c4d0a9a60ca30aaad0a87c (diff) | |
parent | fca54f49bb3541f726da1becffaa60197835ca68 (diff) | |
download | which-ui-dc0d09f568ca9eeda4978c4750b548ba81688c23.tar.gz |
Merge pull request #80 from which-ecosystem/improved-poll-creation
Upload progress logging
Diffstat (limited to 'src/containers/Page')
-rw-r--r-- | src/containers/Page/Page.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx index 848ca1d..023d86e 100644 --- a/src/containers/Page/Page.tsx +++ b/src/containers/Page/Page.tsx @@ -1,8 +1,8 @@ -import React, { Suspense } from 'react'; +import React, { Suspense, useEffect } from 'react'; import { makeStyles, useTheme } from '@material-ui/core/styles'; import { useMediaQuery } from '@material-ui/core'; import { SnackbarProvider } from 'notistack'; -import { Switch, Route } from 'react-router-dom'; +import { Switch, Route, useHistory } from 'react-router-dom'; import Loading from '../../components/Loading/Loading'; const Profile = React.lazy(() => import('../Profile/Profile')); @@ -17,7 +17,7 @@ const PollCreation = React.lazy(() => import('../PollCreation/PollCreation')); const useStyles = makeStyles(theme => ({ root: { [theme.breakpoints.down('sm')]: { - margin: theme.spacing(12, 0, 12, 0) + margin: theme.spacing(10, 0, 12, 0) }, [theme.breakpoints.up('md')]: { margin: theme.spacing(15, 5, 8, 5) @@ -29,8 +29,15 @@ const useStyles = makeStyles(theme => ({ const Page: React.FC = () => { const classes = useStyles(); const theme = useTheme(); + const history = useHistory(); const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + useEffect(() => { + return history.listen(() => { + window.scrollTo(0, 0); + }); + }, [history]); + return ( <SnackbarProvider preventDuplicate |