35 lines
871 B
React
Raw Normal View History

2016-03-12 01:28:19 +03:00
import React from 'react'
import DocumentTitle from 'react-document-title'
2016-06-03 14:05:50 +03:00
import SitePost from '../components/SitePost'
import SitePage from '../components/SitePage'
2016-03-12 01:28:19 +03:00
import { config } from 'config'
class MarkdownWrapper extends React.Component {
2016-03-21 20:03:01 +03:00
render() {
const {route} = this.props
const post = route.page.data
let layout, template
2016-06-03 02:32:38 +03:00
2016-03-21 20:03:01 +03:00
layout = post.layout
2016-03-12 01:28:19 +03:00
2016-03-21 20:03:01 +03:00
if (layout != 'page') {
2016-06-03 14:05:50 +03:00
template = <SitePost {...this.props}/>
2016-03-21 20:03:01 +03:00
} else {
2016-06-03 14:05:50 +03:00
template = <SitePage {...this.props}/>
2016-03-21 20:03:01 +03:00
}
2016-03-12 01:28:19 +03:00
2016-03-21 20:03:01 +03:00
return (
<DocumentTitle title={ `${post.title} - ${config.siteTitle}` }>
<div>
{ template }
</div>
</DocumentTitle>
);
}
2016-03-12 01:28:19 +03:00
}
MarkdownWrapper.propTypes = {
2016-03-21 20:03:01 +03:00
route: React.PropTypes.object,
2016-03-12 01:28:19 +03:00
}
export default MarkdownWrapper