layout.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Layout component that queries for data
  3. * with Gatsby's useStaticQuery component
  4. *
  5. * See: https://www.gatsbyjs.org/docs/use-static-query/
  6. */
  7. import React from "react"
  8. import PropTypes from "prop-types"
  9. import { useStaticQuery, graphql } from "gatsby"
  10. import Header from "./header"
  11. import "./layout.css"
  12. const Layout = ({ children }) => {
  13. const data = useStaticQuery(graphql`
  14. query SiteTitleQuery {
  15. site {
  16. siteMetadata {
  17. title
  18. }
  19. }
  20. }
  21. `)
  22. return (
  23. <>
  24. <Header siteTitle={data.site.siteMetadata.title} />
  25. <div
  26. style={{
  27. margin: `0 auto`,
  28. maxWidth: 960,
  29. padding: `0px 1.0875rem 1.45rem`,
  30. paddingTop: 0,
  31. }}
  32. >
  33. <main>{children}</main>
  34. <footer>
  35. © {new Date().getFullYear()}, Built with
  36. {` `}
  37. <a href="https://www.gatsbyjs.org">Gatsby</a>
  38. </footer>
  39. </div>
  40. </>
  41. )
  42. }
  43. Layout.propTypes = {
  44. children: PropTypes.node.isRequired,
  45. }
  46. export default Layout