sana137.in

Sana's gatsbyjs-based blog
git clone http://git.hanabi.in/repos/sana137.in.git
Log | Files | Refs | README | LICENSE

layout.js (1228B)


      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 
      8 import React from 'react';
      9 import PropTypes from 'prop-types';
     10 import { useStaticQuery, graphql } from 'gatsby';
     11 
     12 import Header from './header';
     13 import Footer from './footer';
     14 
     15 const Layout = ({ children }) => {
     16   const { site } = useStaticQuery(graphql`
     17     query SiteTitleQuery {
     18       site {
     19         siteMetadata {
     20           author
     21           description
     22           headerImg
     23           name
     24           title
     25         }
     26       }
     27     }
     28   `);
     29 
     30   return (
     31     <div className={'home-template'}>
     32       <div className={'site-wrapper'}>
     33         <Header
     34           siteTitle={site.siteMetadata.title}
     35           description={site.siteMetadata.description}
     36           headerImg={site.siteMetadata.headerImg}
     37         />
     38         <main className={'site-main outer'} id={'site-main'}>
     39           {children}
     40         </main>
     41         <Footer
     42           author={site.siteMetadata.author}
     43           name={site.siteMetadata.name}
     44           className={'site-footer outer'}
     45         />
     46       </div>
     47     </div>
     48   );
     49 };
     50 
     51 Layout.propTypes = {
     52   children: PropTypes.node.isRequired,
     53 };
     54 
     55 export default Layout;