2018-08-23 17:58:38 -04:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import Helmet from 'react-helmet';
|
|
|
|
import { graphql, StaticQuery } from 'gatsby';
|
|
|
|
|
|
|
|
import Header from './header';
|
|
|
|
import Footer from './footer';
|
2018-09-06 14:44:58 -04:00
|
|
|
import Notification from './notification';
|
2018-08-23 17:58:38 -04:00
|
|
|
|
|
|
|
import '../css/imports/base.css';
|
|
|
|
import '../css/imports/utilities.css';
|
2019-10-22 20:59:04 -04:00
|
|
|
import '../css/imports/chat.css';
|
2018-08-23 17:58:38 -04:00
|
|
|
|
|
|
|
const Layout = ({ children }) => {
|
|
|
|
return (
|
|
|
|
<StaticQuery
|
|
|
|
query={graphql`
|
|
|
|
query layoutQuery {
|
|
|
|
site {
|
|
|
|
siteMetadata {
|
|
|
|
title
|
|
|
|
description
|
|
|
|
}
|
|
|
|
}
|
|
|
|
footer: file(relativePath: { regex: "/global/" }) {
|
|
|
|
childDataYaml {
|
|
|
|
footer {
|
|
|
|
buttons {
|
|
|
|
url
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notifs: file(relativePath: { regex: "/notifications/" }) {
|
|
|
|
childDataYaml {
|
|
|
|
notifications {
|
|
|
|
published
|
|
|
|
loud
|
|
|
|
message
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`}
|
|
|
|
>
|
|
|
|
{data => {
|
|
|
|
const { title, description } = data.site.siteMetadata;
|
|
|
|
const notifs = data.notifs.childDataYaml.notifications.filter(notif => notif.published);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<Helmet defaultTitle={title} titleTemplate={`%s | ${title}`}>
|
|
|
|
<meta name="description" content={description} />
|
|
|
|
</Helmet>
|
|
|
|
{notifs.map((node, i) => (
|
2018-09-06 14:44:58 -04:00
|
|
|
<Notification key={i} url={node.url} loud={node.loud}>
|
2018-08-23 17:58:38 -04:00
|
|
|
{node.message}
|
2018-09-06 14:44:58 -04:00
|
|
|
</Notification>
|
2018-08-23 17:58:38 -04:00
|
|
|
))}
|
|
|
|
<Header notifications={notifs} />
|
|
|
|
{children}
|
|
|
|
<Footer buttons={data.footer.childDataYaml.footer.buttons} />
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</StaticQuery>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Layout;
|