rickvanlieshout.com/components/SitePost/index.jsx

52 lines
1.3 KiB
React
Raw Normal View History

import React from 'react';
import moment from 'moment';
import { Link } from 'react-router';
import { prefixLink } from 'gatsby-helpers';
import { config } from 'config';
import ReadNext from '../ReadNext';
import './style.css';
import '../../static/css/highlight.css';
2016-03-11 23:28:19 +01:00
2016-06-03 13:05:50 +02:00
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>
);
2016-03-21 18:03:01 +01:00
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>
2016-03-11 23:28:19 +01:00
</div>
</div>
<div className="footer">
<ReadNext post={post} {...this.props} />
<hr />
<p>
{config.siteDescr}
<a href={config.siteTwitterUrl}>
<br /> <strong>{config.siteAuthor}</strong> on Twitter
</a>
</p>
</div>
</div>
</div>
);
}
2016-03-11 23:28:19 +01:00
}
2016-06-03 13:05:50 +02:00
SitePost.propTypes = {
route: React.PropTypes.object.isRequired,
};
2016-03-11 23:28:19 +01:00
export default SitePost;