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 21:12:55 +00:00
|
|
|
import Footer from "./footer"
|
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 21:12:55 +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>
|
2023-01-05 21:12:55 +00:00
|
|
|
<Container maxWidth="md" sx={{ py: 8 }}>
|
2023-01-05 20:05:29 +00:00
|
|
|
<Grid container>
|
2023-01-05 20:11:05 +00:00
|
|
|
<Grid item xs={12} md={3}>
|
2023-01-05 20:05:29 +00:00
|
|
|
<NavMenu />
|
|
|
|
</Grid>
|
2023-01-05 20:11:05 +00:00
|
|
|
<Grid item xs={12} md={9}>
|
2023-01-05 20:05:29 +00:00
|
|
|
<main>{children}</main>
|
|
|
|
</Grid>
|
2023-01-05 10:54:28 +00:00
|
|
|
</Grid>
|
2023-01-05 20:05:29 +00:00
|
|
|
</Container>
|
2023-01-05 21:12:55 +00:00
|
|
|
<Footer />
|
2023-01-05 20:05:29 +00:00
|
|
|
</ThemeProvider>
|
2023-01-05 10:35:42 +00:00
|
|
|
</>
|
2023-01-05 07:13:30 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Layout
|