Created
May 3, 2019 01:14
-
-
Save lukejoliat/44ff1a34ab78d82aae0032e832c19673 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Layout component that queries for data | |
* with Gatsby's StaticQuery component | |
*/ | |
import React from "react" | |
import PropTypes from "prop-types" | |
import { StaticQuery, graphql } from "gatsby" | |
import Header from "./header" | |
import "./layout.css" | |
const Layout = ({ children }) => ( | |
<StaticQuery | |
query={graphql` | |
query SiteTitleQuery { | |
site { | |
siteMetadata { | |
title | |
} | |
} | |
} | |
`} | |
render={data => ( | |
<> | |
<Header siteTitle={data.site.siteMetadata.title} /> | |
<div | |
style={{ | |
margin: `0 auto`, | |
maxWidth: 960, | |
padding: `0px 1.0875rem 1.45rem`, | |
paddingTop: 0, | |
}} | |
> | |
<main>{children}</main> | |
</div> | |
</> | |
)} | |
/> | |
) | |
Layout.propTypes = { | |
children: PropTypes.node.isRequired, | |
} | |
export default Layout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment