mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-12 11:46:40 +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 React from "react";
|
||||||
import { Router } from "react-router-dom";
|
import { Router } from "react-router-dom";
|
||||||
import Layout from "./pages/Layout";
|
|
||||||
import { useAuth0 } from "./authentication/auth0";
|
import { useAuth0 } from "./authentication/auth0";
|
||||||
// import history from "./utils/history";
|
|
||||||
import * as createHistory from "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 const history = createHistory.createBrowserHistory();
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { loading } = useAuth0();
|
const { loading } = useAuth0();
|
||||||
|
|
||||||
|
|
@ -14,7 +17,9 @@ export default function App() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
<Layout />
|
<MainLayout>
|
||||||
|
<AppRouter />
|
||||||
|
</MainLayout>
|
||||||
</Router>
|
</Router>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,28 @@
|
||||||
import React from "react";
|
import React, { FC } from "react";
|
||||||
import CssBaseline from "@material-ui/core/CssBaseline";
|
import CssBaseline from "@material-ui/core/CssBaseline";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import { AppRouter } from "../utils/router";
|
|
||||||
import ButtonAppBar from "../components/ButtonAppBar";
|
import ButtonAppBar from "../components/ButtonAppBar";
|
||||||
import Footer from "../components/Footer";
|
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: {
|
root: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
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();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
|
|
@ -26,8 +31,10 @@ export default function Layout() {
|
||||||
</header>
|
</header>
|
||||||
{/* <BreadCrumb /> */}
|
{/* <BreadCrumb /> */}
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<AppRouter />
|
{children}
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default MainLayout;
|
||||||
Loading…
Reference in a new issue