Files
old-v2-frontend/src/templates/post-default.js

75 lines
2.0 KiB
JavaScript
Raw Normal View History

2018-08-27 15:24:23 +02:00
import React, { Component } from 'react'
import Helmet from 'react-helmet'
import Prism from 'prismjs'
require('prismjs/themes/prism-solarizedlight.css')
import PageTransition from 'gatsby-plugin-page-transitions'
2018-09-05 23:01:06 +02:00
import MessengerCustomerChat from 'react-messenger-customer-chat'
import favicon32 from '../images/favicon32.png'
class PostDefault extends Component {
componentDidMount() {
Prism.highlightAll()
}
2018-06-25 15:28:50 +02:00
render() {
const { data } = this.props
return (
<PageTransition>
<Helmet
title={`${data.wordpressPost.title} - Saburly.com`}
meta={[
{ name: 'description', content: 'We code & design great software' },
2018-08-27 15:24:23 +02:00
{
name: 'keywords',
content:
'software, design, coding, programming, code, consulting',
},
]}
link={[
{ rel: 'shortcut icon', type: 'image/png', href: `${favicon32}` },
]}
/>
2018-09-05 12:15:12 +02:00
<main className="container mx-auto p-4 max-w-lg sm:p-10">
2018-09-12 12:06:57 +02:00
<img
className="w-full rounded"
src={
data.wordpressPost.featured_media
? data.wordpressPost.featured_media.source_url
: ''
}
/>
<h1 className="mt-4">{data.wordpressPost.title}</h1>
2018-08-27 15:24:23 +02:00
<div
2018-09-12 12:06:57 +02:00
className="leading-normal blog-post font-serif"
2018-08-27 15:24:23 +02:00
dangerouslySetInnerHTML={{
__html: data.wordpressPost.content,
}}
/>
2018-09-05 23:01:06 +02:00
<MessengerCustomerChat
pageId="715686642152482"
appId="1896398823783343"
htmlRef="blogpost"
/>
2018-08-27 15:24:23 +02:00
</main>
</PageTransition>
2018-08-27 15:24:23 +02:00
)
2018-06-25 15:28:50 +02:00
}
}
export const query = graphql`
query PostDefaultQuery($slug: String!) {
2018-08-27 15:24:23 +02:00
wordpressPost(slug: { eq: $slug }) {
2018-06-25 15:28:50 +02:00
title
slug
content
2018-09-12 12:06:57 +02:00
date(formatString: "MMMM DD, YYYY")
featured_media {
source_url
}
2018-06-25 15:28:50 +02:00
}
}
`
2018-08-27 15:24:23 +02:00
export default PostDefault