mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 00:36:39 +00:00
Created MainLayout moved AppRouter to App
This commit is contained in:
parent
382dc145c8
commit
880d7fafda
3 changed files with 26 additions and 14 deletions
BIN
app.db
BIN
app.db
Binary file not shown.
|
|
@ -1,10 +1,13 @@
|
|||
import React from "react";
|
||||
import { Router } from "react-router-dom";
|
||||
import Layout from "./pages/Layout";
|
||||
import { useAuth0 } from "./authentication/auth0";
|
||||
// import history from "./utils/history";
|
||||
import * as createHistory from "history";
|
||||
// import history from "./utils/history";
|
||||
import MainLayout from "./layouts/MainLayout";
|
||||
import { AppRouter } from "./utils/router";
|
||||
|
||||
export const history = createHistory.createBrowserHistory();
|
||||
|
||||
export default function App() {
|
||||
const { loading } = useAuth0();
|
||||
|
||||
|
|
@ -14,7 +17,9 @@ export default function App() {
|
|||
|
||||
return (
|
||||
<Router history={history}>
|
||||
<Layout />
|
||||
<MainLayout>
|
||||
<AppRouter />
|
||||
</MainLayout>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,28 @@
|
|||
import React from "react";
|
||||
import React, { FC } from "react";
|
||||
import CssBaseline from "@material-ui/core/CssBaseline";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { AppRouter } from "../utils/router";
|
||||
import ButtonAppBar from "../components/ButtonAppBar";
|
||||
import Footer from "../components/Footer";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
/**
|
||||
* @function useStyles creates the css styles used in the following component.
|
||||
*/
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
// root style allow for fixed footer
|
||||
root: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
minHeight: "100vh"
|
||||
minHeight: "100vh",
|
||||
},
|
||||
main: {
|
||||
marginTop: theme.spacing(8),
|
||||
marginBottom: theme.spacing(2)
|
||||
}
|
||||
}));
|
||||
|
||||
export default function Layout() {
|
||||
/**
|
||||
* MainLayout is the principal page layout. It mainly ensure the footer is fixed
|
||||
* to the page bottom.
|
||||
*
|
||||
* @param children - The encapsulated component.
|
||||
*/
|
||||
const MainLayout: FC = ({ children }) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
|
|
@ -26,8 +31,10 @@ export default function Layout() {
|
|||
</header>
|
||||
{/* <BreadCrumb /> */}
|
||||
<CssBaseline />
|
||||
<AppRouter />
|
||||
{children}
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default MainLayout;
|
||||
Loading…
Reference in a new issue