forked from jlengstorf/gatsby-theme-jam-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update gatsby-node and render posts (not currently working)
- Loading branch information
Becca Bailey
committed
Jul 29, 2019
1 parent
695ebb5
commit 9b08194
Showing
10 changed files
with
306 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** @jsx jsx */ | ||
import { jsx } from "theme-ui" | ||
|
||
const Grid = ({ columns, children, padding = 3 }) => { | ||
return ( | ||
<div | ||
sx={{ | ||
display: "grid", | ||
gridColumnGap: 3, | ||
gridTemplateColumns: ["repeat(1, 1fr)", `repeat(${columns}, 1fr)`], | ||
padding: 3, | ||
}} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
export default Grid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { graphql, Link } from "gatsby" | ||
import React from "react" | ||
import Layout from "../components/layout" | ||
import PostMetadata from "../components/post-metadata" | ||
/** @jsx jsx */ | ||
import { jsx } from "theme-ui" | ||
|
||
class BlogPostTemplate extends React.Component { | ||
render() { | ||
const post = this.props.data.markdownRemark | ||
const siteTitle = this.props.data.site.siteMetadata.title | ||
const { previous, next } = this.props.pageContext | ||
|
||
return ( | ||
<Layout location={this.props.location} title={siteTitle}> | ||
<h1>{post.frontmatter.title}</h1> | ||
<PostMetadata | ||
formattedDagte={post.frontmatter.date} | ||
timeToRead={post.timeToRead} | ||
/> | ||
<div dangerouslySetInnerHTML={{ __html: post.html }} /> | ||
<ul | ||
sx={{ | ||
display: `flex`, | ||
flexWrap: `wrap`, | ||
justifyContent: `space-between`, | ||
listStyle: `none`, | ||
padding: 0, | ||
}} | ||
> | ||
<li> | ||
{previous && ( | ||
<Link to={previous.fields.slug} rel="prev"> | ||
← {previous.frontmatter.title} | ||
</Link> | ||
)} | ||
</li> | ||
<li> | ||
{next && ( | ||
<Link to={next.fields.slug} rel="next"> | ||
{next.frontmatter.title} → | ||
</Link> | ||
)} | ||
</li> | ||
</ul> | ||
</Layout> | ||
) | ||
} | ||
} | ||
|
||
export default BlogPostTemplate | ||
|
||
export const pageQuery = graphql` | ||
query BlogPostBySlug($slug: String!) { | ||
site { | ||
siteMetadata { | ||
title | ||
author | ||
} | ||
} | ||
markdownRemark(fields: { slug: { eq: $slug } }) { | ||
html | ||
timeToRead | ||
frontmatter { | ||
title | ||
date(formatString: "MMMM DD, YYYY") | ||
description | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.