Files
old-v2-frontend/src/templates/blog.js
2018-09-12 14:06:23 +02:00

72 lines
1.9 KiB
JavaScript

import React, { Component } from 'react'
import Link from 'gatsby-link'
import PageIntro from '../components/PageIntro'
import Card from '../components/Card'
import SEO from '../components/SEO'
import PageTransition from 'gatsby-plugin-page-transitions'
class Blog extends Component {
render() {
const data = this.props.data
return (
<PageTransition>
<SEO siteTitle="Saburly - Blog Posts" siteDescription="Bugs keep us busy, but sometimes we find the time to have fun & publish" />
<div className="container mx-auto p-4 w-full md:flex md:flex-wrap items-stretch w-full" siteUrl="https://saburly.com/blog">
{data.allWordpressPost.edges.map(({ node }) => (
<div key={node.id} className="mt-4 md:w-1/2 p-2">
<Link
to={`blog/${node.slug}`}
className="pointer no-underline saburly-transition hover:opacity-50"
>
<Card
title={node.title}
date={node.date}
excerpt={node.excerpt}
image={
node.featured_media
? node.featured_media.localFile.childImageSharp
.resolutions
: undefined
}
/>
</Link>
</div>
))}
</div>
</PageTransition>
)
}
}
export const query = graphql`
query blogQuery {
allWordpressPost {
edges {
node {
id
title
excerpt
status
slug
date(formatString: "MMMM DD, YYYY")
featured_media {
localFile {
childImageSharp {
resolutions(width: 600, height: 300) {
src
width
height
}
}
}
}
}
}
}
}
`
export default Blog