From 05c72f4781f73fd870c41391f2e20a78333e693d Mon Sep 17 00:00:00 2001 From: Jandson Vitorino Date: Mon, 18 Mar 2024 17:13:17 -0300 Subject: [PATCH] Fixed #226 - Adjust the overflowY property in the main file. --- frontend/pages/_app.js | 23 ++++++++++++++++++++--- frontend/pages/tutorials.js | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js index 0278f92..2a3c650 100644 --- a/frontend/pages/_app.js +++ b/frontend/pages/_app.js @@ -1,5 +1,6 @@ import CssBaseline from '@mui/material/CssBaseline' import { ThemeProvider } from '@mui/material/styles' +import Box from '@mui/material/Box' import Head from 'next/head' import { useRouter } from 'next/router' import PropTypes from 'prop-types' @@ -18,6 +19,7 @@ export default function MyApp(props) { const { Component, pageProps } = props const route = useRouter() const [darkMode, setDarkMode] = useState(false) + const [scrollNeeded, setScrollNeeded] = useState(false) useEffect(() => { const jssStyles = document.querySelector('#jss-server-side') @@ -29,8 +31,22 @@ export default function MyApp(props) { if (darkModePreference) { setDarkMode(darkModePreference === '1') } + + handleScroll() }, []) + useEffect(() => { + handleScroll() + }, [route.pathname]) + + const handleScroll = () => { + const contentHeight = document.body.scrollHeight + const windowHeight = window.innerHeight + const hasVerticalScrollbar = contentHeight > windowHeight + + setScrollNeeded(hasVerticalScrollbar) + } + return ( <> @@ -43,12 +59,13 @@ export default function MyApp(props) { -
@@ -62,7 +79,7 @@ export default function MyApp(props) { {route.pathname !== '/login' &&
} -
+
diff --git a/frontend/pages/tutorials.js b/frontend/pages/tutorials.js index 4768962..bd05830 100644 --- a/frontend/pages/tutorials.js +++ b/frontend/pages/tutorials.js @@ -14,7 +14,7 @@ export default function Tutorials() { const classes = useStyles() return ( - +