fesite/src/components/layout.tsx

47 lines
873 B
TypeScript
Raw Normal View History

2020-01-23 12:06:17 +00:00
/**
* Layout component that queries for data
* with Gatsby's useStaticQuery component
*
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
2020-01-23 15:10:37 +00:00
import React from "react";
import PropTypes from "prop-types";
import { useStaticQuery, graphql } from "gatsby";
2020-01-23 12:06:17 +00:00
2020-01-23 15:10:37 +00:00
import Header from "./header";
import "./layout.scss";
2020-01-23 12:06:17 +00:00
const Layout = ({ children }) => {
const data = useStaticQuery(graphql`
query SiteTitleQuery {
site {
siteMetadata {
title
}
}
}
2020-01-23 15:10:37 +00:00
`);
2020-01-23 12:06:17 +00:00
return (
<>
<Header siteTitle={data.site.siteMetadata.title} />
<div
style={{
margin: `0 auto`,
maxWidth: 960,
padding: `0 1.0875rem 1.45rem`,
}}
>
<main>{children}</main>
</div>
</>
2020-01-23 15:10:37 +00:00
);
};
2020-01-23 12:06:17 +00:00
Layout.propTypes = {
children: PropTypes.node.isRequired,
2020-01-23 15:10:37 +00:00
};
2020-01-23 12:06:17 +00:00
2020-01-23 15:10:37 +00:00
export default Layout;