-
Notifications
You must be signed in to change notification settings - Fork 0
/
Layout.tsx
57 lines (53 loc) · 1.37 KB
/
Layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from 'react';
import { css } from '@emotion/core';
import Helmet from 'react-helmet';
import { useStaticQuery, graphql } from 'gatsby';
import { rhythm } from '../utils/typography';
import Header from './Header';
import { SiteTitleQuery } from '../../types/graphql-type';
// Let's guarantee Amplify is configured on every page
import Amplify from 'aws-amplify';
import config from '../aws-exports';
Amplify.configure(config);
export default function Layout({ children }: React.PropsWithChildren<{}>) {
const data: SiteTitleQuery = useStaticQuery(graphql`
query SiteTitle {
site {
siteMetadata {
title
description
author
}
}
}
`);
const { title, description, author } = data.site?.siteMetadata ?? {};
return (
<>
<Helmet
title={title ?? ''}
meta={[
{
name: 'description',
content: description ?? '',
},
{ name: 'keywords', content: 'sample, something' },
{ name: 'author', content: author ?? '' },
]}
>
<html lang="en" />
</Helmet>
<div
css={css`
margin: 0 auto;
max-width: 700px;
padding: ${rhythm(2)};
padding-top: ${rhythm(1.5)};
`}
>
<Header siteTitle={title ?? ''} />
{children}
</div>
</>
);
}