diff options
Diffstat (limited to '@linaria/examples/gatsby/plugin/src/components/layout.js')
-rw-r--r-- | @linaria/examples/gatsby/plugin/src/components/layout.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/@linaria/examples/gatsby/plugin/src/components/layout.js b/@linaria/examples/gatsby/plugin/src/components/layout.js new file mode 100644 index 0000000..0359ea6 --- /dev/null +++ b/@linaria/examples/gatsby/plugin/src/components/layout.js @@ -0,0 +1,51 @@ +/** + * Layout component that queries for data + * with Gatsby's useStaticQuery component + * + * See: https://www.gatsbyjs.org/docs/use-static-query/ + */ + +import React from "react" +import PropTypes from "prop-types" +import { useStaticQuery, graphql } from "gatsby" + +import Header from "./header" +import "./layout.css" + +const Layout = ({ children }) => { + const data = useStaticQuery(graphql` + query SiteTitleQuery { + site { + siteMetadata { + title + } + } + } + `) + + return ( + <> + <Header siteTitle={data.site.siteMetadata.title} /> + <div + style={{ + margin: `0 auto`, + maxWidth: 960, + padding: `0 1.0875rem 1.45rem`, + }} + > + <main>{children}</main> + <footer> + © {new Date().getFullYear()}, Built with + {` `} + <a href="https://www.gatsbyjs.org">Gatsby</a> + </footer> + </div> + </> + ) +} + +Layout.propTypes = { + children: PropTypes.node.isRequired, +} + +export default Layout |