-
Notifications
You must be signed in to change notification settings - Fork 21
/
blog-post.js
54 lines (49 loc) · 1.45 KB
/
blog-post.js
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
import React from 'react';
import { graphql } from 'gatsby';
import Layout from '../components/layout';
import SEO from '../components/seo';
/*
This is used in blog posts. The index page can be found at src/pages/blog.js
*/
const BlogPost = ({ data }) => {
const { markdownRemark } = data;
const { frontmatter, html } = markdownRemark;
return (
<Layout>
<SEO title={frontmatter.title} />
<div className="usa-layout-docs usa-section">
<div className="grid-container">
<div className="grid-row grid-gap">
<div className="usa-layout-docs__main desktop:grid-col-9 usa-prose">
<main id="main-content">
<h1 className="title">{frontmatter.title}</h1>
<div className="text-base margin-bottom-2">
<div className="margin-top-neg-105">
By <span className="text-bold">{frontmatter.author}</span> ·{' '}
{frontmatter.date}
</div>
<span dangerouslySetInnerHTML={{ __html: html }} />
</div>
</main>
</div>
</div>
</div>
</div>
</Layout>
);
};
export const pageQuery = graphql`
query ($name: String!) {
markdownRemark(
fields: { sourceName: { eq: "blog-posts" }, name: { eq: $name } }
) {
html
frontmatter {
author
date
title
}
}
}
`;
export default BlogPost;