rickvanlieshout.com/components/BlogPost/index.jsx

56 lines
1.6 KiB
React
Raw Normal View History

2016-03-11 23:28:19 +01:00
import React from 'react'
import moment from 'moment'
import { RouteHandler, Link } from 'react-router'
import DocumentTitle from 'react-document-title'
import { link } from 'gatsby-helpers'
import access from 'safe-access'
import ReadNext from '../ReadNext'
import { config } from 'config'
import './style.sss'
import '../../static/css/highlight.css'
class BlogPost extends React.Component {
2016-03-21 18:03:01 +01:00
render() {
const {route} = this.props
const post = route.page.data
const home = (
2016-03-11 23:28:19 +01:00
<div>
2016-03-21 18:03:01 +01:00
<Link className='gohome' to={ link('/') }> All Articles
</Link>
</div>
)
return (
<div>
{ home }
<div className='blog-single'>
<div className='text'>
<h1>{ post.title }</h1>
<div dangerouslySetInnerHTML={ { __html: post.body} } />
<div className='date-published'>
<em>Published { moment(post.datePublished).format('D MMM YYYY') }</em>
</div>
2016-03-11 23:28:19 +01:00
</div>
2016-03-21 18:03:01 +01:00
<div className='footer'>
<ReadNext post={ post } {...this.props}/>
<hr></hr>
<p>
{ config.siteDescr }
<a href={ config.twitter }>
<br></br> <strong>{ config.authorName }</strong> on Twitter</a>
</p>
</div>
</div>
2016-03-11 23:28:19 +01:00
</div>
2016-03-21 18:03:01 +01:00
);
}
2016-03-11 23:28:19 +01:00
}
BlogPost.propTypes = {
2016-03-21 18:03:01 +01:00
post: React.PropTypes.object.isRequired,
pages: React.PropTypes.array,
2016-03-11 23:28:19 +01:00
}
export default BlogPost