Files
Mind-Expanding-Books/app/src/components/layout.js
Josh RosenHanst fb6e2e8b5d React error fixes (#180)
* fix className errors by replacing class= with className= in templates; remove unused imports

* fix component key warning by adding the node.id key to the component
2019-10-17 11:51:25 +05:30

46 lines
927 B
JavaScript

/**
* 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 className="container mx-auto px-10">
<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