rickvanlieshout.com/wrappers/md.jsx

35 lines
796 B
React
Raw Normal View History

import React from 'react';
import Helmet from 'react-helmet';
import { config } from 'config';
2016-03-11 23:28:19 +01:00
import SitePost from '../components/SitePost';
import SitePage from '../components/SitePage';
2016-03-11 23:28:19 +01:00
class MarkdownWrapper extends React.Component {
render() {
const { route } = this.props;
const post = route.page.data;
const layout = post.layout;
let template;
2016-03-11 23:28:19 +01:00
if (layout !== 'page') {
template = <SitePost {...this.props} />;
} else {
template = <SitePage {...this.props} />;
2016-03-21 18:03:01 +01:00
}
return (
<div>
<Helmet title={`${post.title} - ${config.siteTitle}`} />
{template}
</div>
);
}
2016-03-11 23:28:19 +01:00
}
MarkdownWrapper.propTypes = {
route: React.PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
2016-03-11 23:28:19 +01:00
export default MarkdownWrapper;