2016-03-11 23:28:19 +01:00
|
|
|
import React from 'react'
|
2016-11-23 22:41:17 +01:00
|
|
|
import Helmet from 'react-helmet'
|
2016-06-03 13:05:50 +02:00
|
|
|
import SitePost from '../components/SitePost'
|
|
|
|
import SitePage from '../components/SitePage'
|
2016-03-11 23:28:19 +01:00
|
|
|
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
|
|
|
|
let layout, template
|
2016-06-03 01:32:38 +02:00
|
|
|
|
2016-03-21 18:03:01 +01:00
|
|
|
layout = post.layout
|
2016-03-11 23:28:19 +01:00
|
|
|
|
2016-03-21 18:03:01 +01:00
|
|
|
if (layout != 'page') {
|
2016-06-03 13:05:50 +02:00
|
|
|
template = <SitePost {...this.props}/>
|
2016-03-21 18:03:01 +01:00
|
|
|
} else {
|
2016-06-03 13:05:50 +02:00
|
|
|
template = <SitePage {...this.props}/>
|
2016-03-21 18:03:01 +01:00
|
|
|
}
|
2016-03-11 23:28:19 +01:00
|
|
|
|
2016-03-21 18:03:01 +01:00
|
|
|
return (
|
2016-11-23 22:41:17 +01:00
|
|
|
<div>
|
|
|
|
<Helmet title={ `${post.title} - ${config.siteTitle}` }/>
|
|
|
|
{ template }
|
|
|
|
</div>
|
2016-03-21 18:03:01 +01:00
|
|
|
);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2016-11-23 22:41:17 +01:00
|
|
|
export default MarkdownWrapper
|