2023-01-05 07:13:30 +00:00
|
|
|
import * as React from "react"
|
2023-01-05 10:35:42 +00:00
|
|
|
import { Link as GatsbyLink } from "gatsby"
|
2023-01-05 20:05:29 +00:00
|
|
|
import { AppBar, Container, CssBaseline, Grid, Link, ThemeProvider, Toolbar } from "@mui/material"
|
2023-01-05 10:54:28 +00:00
|
|
|
import NavMenu from "./nav-menu"
|
2023-01-05 20:05:29 +00:00
|
|
|
import theme from "./theme"
|
2023-01-05 07:13:30 +00:00
|
|
|
|
|
|
|
const Layout = ({ location, title, children }) => {
|
2023-01-05 10:35:42 +00:00
|
|
|
// const rootPath = `${__PATH_PREFIX__}/`
|
|
|
|
// const isRootPath = location.pathname === rootPath
|
|
|
|
// let header
|
2023-01-05 07:13:30 +00:00
|
|
|
|
2023-01-05 10:35:42 +00:00
|
|
|
// if (isRootPath) {
|
|
|
|
// header = (
|
|
|
|
// <h1 className="main-heading">
|
|
|
|
// <Link to="/">{title}</Link>
|
|
|
|
// </h1>
|
|
|
|
// )
|
|
|
|
// } else {
|
|
|
|
// header = (
|
|
|
|
// <Link className="header-link-home" to="/">
|
|
|
|
// {title}
|
|
|
|
// </Link>
|
|
|
|
// )
|
|
|
|
// }
|
2023-01-05 07:13:30 +00:00
|
|
|
|
|
|
|
return (
|
2023-01-05 10:35:42 +00:00
|
|
|
<>
|
2023-01-05 20:05:29 +00:00
|
|
|
<ThemeProvider theme={theme}>
|
2023-01-05 11:10:57 +00:00
|
|
|
<CssBaseline />
|
2023-01-05 20:05:29 +00:00
|
|
|
<AppBar
|
|
|
|
component="header"
|
|
|
|
color="transparent"
|
|
|
|
position="relative"
|
|
|
|
elevation={0}
|
|
|
|
>
|
|
|
|
<Toolbar>
|
|
|
|
<Link
|
|
|
|
underline="hover"
|
|
|
|
component={GatsbyLink}
|
|
|
|
to="/"
|
|
|
|
sx={{ textTransform: "lowercase" }}
|
|
|
|
>
|
|
|
|
{title}
|
|
|
|
</Link>
|
|
|
|
</Toolbar>
|
|
|
|
</AppBar>
|
|
|
|
<Container>
|
|
|
|
<Grid container>
|
|
|
|
<Grid item xs={12} md={2}>
|
|
|
|
<NavMenu />
|
|
|
|
</Grid>
|
|
|
|
<Grid item xs={12} md={10}>
|
|
|
|
<main>{children}</main>
|
|
|
|
</Grid>
|
2023-01-05 10:54:28 +00:00
|
|
|
</Grid>
|
2023-01-05 20:05:29 +00:00
|
|
|
<footer>
|
|
|
|
© {new Date().getFullYear()}, Built with
|
|
|
|
{` `}
|
|
|
|
<a href="https://www.gatsbyjs.com">Gatsby</a>
|
|
|
|
</footer>
|
|
|
|
</Container>
|
|
|
|
</ThemeProvider>
|
2023-01-05 10:35:42 +00:00
|
|
|
</>
|
2023-01-05 07:13:30 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Layout
|