rickvanlieshout.com/wrappers/md.jsx
2016-06-03 14:05:50 +03:00

35 lines
871 B
JavaScript

import React from 'react'
import DocumentTitle from 'react-document-title'
import SitePost from '../components/SitePost'
import SitePage from '../components/SitePage'
import { config } from 'config'
class MarkdownWrapper extends React.Component {
render() {
const {route} = this.props
const post = route.page.data
let layout, template
layout = post.layout
if (layout != 'page') {
template = <SitePost {...this.props}/>
} else {
template = <SitePage {...this.props}/>
}
return (
<DocumentTitle title={ `${post.title} - ${config.siteTitle}` }>
<div>
{ template }
</div>
</DocumentTitle>
);
}
}
MarkdownWrapper.propTypes = {
route: React.PropTypes.object,
}
export default MarkdownWrapper