Files
old-v2-frontend/src/templates/blog.js

70 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-07-05 20:43:56 +02:00
import React, { Component } from 'react'
2018-07-05 20:56:44 +02:00
import Link from 'gatsby-link'
2018-07-05 20:43:56 +02:00
2018-07-06 23:32:12 +02:00
import PageIntro from '../components/PageIntro'
2018-07-06 09:35:17 +02:00
import Card from '../components/Card'
import PageTransition from 'gatsby-plugin-page-transitions'
2018-07-05 20:43:56 +02:00
class Blog extends Component {
render() {
2018-07-05 20:56:44 +02:00
const data = this.props.data
return (
<PageTransition>
2018-07-09 13:39:50 +02:00
<PageIntro
2018-08-27 15:24:23 +02:00
headline="Bugs keep us busy"
text="but occasionally we have fun & publish"
2018-07-09 13:39:50 +02:00
sectionClasses="mb-16 lg:mb-4"
/>
2018-07-06 23:32:12 +02:00
<div className="container mx-auto p-4 w-full md:flex md:flex-wrap items-stretch w-full">
{data.allWordpressPost.edges.map(({ node }) => (
2018-07-07 00:07:28 +02:00
<div key={node.id} className="mt-4 md:w-1/2 p-2">
2018-07-06 23:32:12 +02:00
<Card
url={`blog/${node.slug}`}
title={node.title}
date={node.date}
excerpt={node.excerpt}
image={
node.featured_media
? node.featured_media.localFile.childImageSharp.resolutions
: undefined
}
/>
</div>
))}
</div>
</PageTransition>
2018-07-05 20:56:44 +02:00
)
2018-07-05 20:43:56 +02:00
}
}
export const query = graphql`
query blogQuery {
allWordpressPost {
edges {
node {
id
title
excerpt
status
2018-07-05 20:43:56 +02:00
slug
date(formatString: "MMMM DD, YYYY")
2018-07-06 10:23:57 +02:00
featured_media {
localFile {
childImageSharp {
resolutions(width: 600, height: 300) {
src
width
height
}
}
}
}
2018-07-05 20:43:56 +02:00
}
}
}
}
`
export default Blog