mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-27 23:38:07 +01:00
eb9274ae92
* Changed required prop from post to route * Removed propType for pages * These are objects on route prop and not passed in individually * Closes #25
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import React from 'react'
|
|
import moment from 'moment'
|
|
import { RouteHandler, Link } from 'react-router'
|
|
import { prefixLink } from 'gatsby-helpers'
|
|
import access from 'safe-access'
|
|
import { config } from 'config'
|
|
import ReadNext from '../ReadNext'
|
|
import './style.css'
|
|
import '../../static/css/highlight.css'
|
|
|
|
class SitePost extends React.Component {
|
|
render() {
|
|
const {route} = this.props
|
|
const post = route.page.data
|
|
const home = (
|
|
<div>
|
|
<Link className='gohome' to={ prefixLink('/') }> 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.date).format('D MMM YYYY') }</em>
|
|
</div>
|
|
</div>
|
|
<div className='footer'>
|
|
<ReadNext post={ post } {...this.props}/>
|
|
<hr></hr>
|
|
<p>
|
|
{ config.siteDescr }
|
|
<a href={ config.siteTwitterUrl }>
|
|
<br></br> <strong>{ config.siteAuthor }</strong> on Twitter</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
SitePost.propTypes = {
|
|
route: React.PropTypes.object.isRequired
|
|
}
|
|
|
|
export default SitePost
|