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-07 21:14:09 +00:00
|
|
|
import { AppBar, Box, 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-07 21:14:09 +00:00
|
|
|
import flower from "../images/flower.png"
|
2023-01-05 07:13:30 +00:00
|
|
|
|
2023-01-08 17:32:47 +00:00
|
|
|
const Layout = ({ location, title, children, noHeader }) => {
|
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-08 17:32:47 +00:00
|
|
|
{!noHeader && (
|
|
|
|
<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-07 21:14:09 +00:00
|
|
|
<Container maxWidth="lg" sx={{ py: 8 }}>
|
2023-01-06 12:33:29 +00:00
|
|
|
<Grid container spacing={2}>
|
2023-01-07 21:14:09 +00:00
|
|
|
<Grid item xs={12} md={2}>
|
2023-01-06 12:33:29 +00:00
|
|
|
<NavMenu location={location} />
|
2023-01-05 20:05:29 +00:00
|
|
|
</Grid>
|
2023-01-07 21:14:09 +00:00
|
|
|
<Grid item xs={12} md={6}>
|
2023-01-05 20:05:29 +00:00
|
|
|
<main>{children}</main>
|
|
|
|
</Grid>
|
2023-01-07 21:14:09 +00:00
|
|
|
<Grid item xs={12} md={4}>
|
|
|
|
<Box position={"relative"} height="100%" zIndex={-100}>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
position: "absolute",
|
|
|
|
height: "100%",
|
|
|
|
width: "100%",
|
|
|
|
bottom: -90,
|
|
|
|
backgroundImage: `url(${flower})`,
|
|
|
|
backgroundRepeat: "no-repeat",
|
|
|
|
backgroundPositionY: "100%",
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
</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
|