Skip to content

Commit

Permalink
fix MainLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
Endo committed May 6, 2023
1 parent 3d06656 commit 3d884c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/components/MainLoadingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import CircularProgress from "@mui/material/CircularProgress";
function MainLoadingScreen() {
return (
<Box
flexGrow={1}
display="flex"
justifyContent="center"
alignItems="center"
sx={{ height: "100vh" }}
sx={{ height: "100%" }}
>
<CircularProgress sx={{ color: "white" }} />
</Box>
Expand Down
15 changes: 13 additions & 2 deletions src/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Outlet, useLocation } from "react-router-dom";
import Box from "@mui/material/Box";

import DetailModal from "src/components/DetailModal";
import VideoPortalContainer from "src/components/VideoPortalContainer";
import DetailModalProvider from "src/providers/DetailModalProvider";
Expand All @@ -9,7 +11,16 @@ import { MAIN_PATH } from "src/constant";
export default function MainLayout() {
const location = useLocation();
return (
<>
<Box
sx={{
width: "100%",
minHeight: "100vh",
display: "flex",
flexDirection: "column",
bgcolor: "background.default",
position: "relative",
}}
>
<MainHeader />
<DetailModalProvider>
<DetailModal />
Expand All @@ -19,6 +30,6 @@ export default function MainLayout() {
</PortalProvider>
</DetailModalProvider>
{location.pathname !== `/${MAIN_PATH.watch}` && <Footer />}
</>
</Box>
);
}
18 changes: 4 additions & 14 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ReactDOM from "react-dom/client";
import { Provider } from "react-redux";
import { RouterProvider } from "react-router-dom";
import { createTheme, ThemeProvider } from "@mui/material/styles";
import Box from "@mui/material/Box";

import store from "./store";
import { extendedApi } from "./store/slices/configuration";
Expand All @@ -23,19 +22,10 @@ root.render(
<Provider store={store}>
<React.StrictMode>
<ThemeProvider theme={createTheme({ palette })}>
<Box
sx={{
width: "100%",
height: "100vh",
bgcolor: "background.default",
position: "relative",
}}
>
<RouterProvider
router={router}
fallbackElement={<MainLoadingScreen />}
/>
</Box>
<RouterProvider
router={router}
fallbackElement={<MainLoadingScreen />}
/>
</ThemeProvider>
</React.StrictMode>
</Provider>
Expand Down

0 comments on commit 3d884c0

Please sign in to comment.