This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathPageLayout.jsx
63 lines (59 loc) · 1.52 KB
/
PageLayout.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as React from 'react';
import { graphql, StaticQuery } from 'gatsby';
import { BuilderComponent } from '@builder.io/react';
import { makeStyles } from '@material-ui/core/styles';
import Link from '../components/Link/Link';
import '../builder-settings';
import theme from '../theme';
const useStyles = makeStyles(them => ({
root: {
padding: theme.spacing(1)
},
header: {},
footer: {},
content: {}
}));
const query = graphql`
query {
allBuilderModels {
header(limit: 1, options: { cachebust: true }) {
content
}
footer(limit: 1, options: { cachebust: true }) {
content
}
}
}
`;
function PageLayout({ children }) {
const classes = useStyles();
return (
<StaticQuery query={query}>
{data => {
const models = data.allBuilderModels;
const header = models.header[0].content;
const footer = models.footer[0].content;
return (
<div className={classes.root}>
<div className={classes.header}>
<BuilderComponent
renderLink={Link}
name="header"
content={header}
/>
</div>
<div className={classes.content}>{children}</div>
<div className={classes.footer}>
<BuilderComponent
renderLink={Link}
name="footer"
content={footer}
/>
</div>
</div>
);
}}
</StaticQuery>
);
}
export default PageLayout;