rickvanlieshout.com/wrappers/md.jsx

35 lines
871 B
React
Raw Normal View History

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