rickvanlieshout.com/html.js

43 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-03-11 23:28:19 +01:00
import React from 'react'
import DocumentTitle from 'react-document-title'
import { link } from 'gatsby-helpers'
module.exports = React.createClass({
2016-03-21 18:03:01 +01:00
propTypes() {
return {
title: React.PropTypes.string,
}
},
render() {
let title = DocumentTitle.rewind()
if (this.props.title) {
title = this.props.title
}
2016-03-11 23:28:19 +01:00
2016-03-21 18:03:01 +01:00
let cssLink
if (process.env.NODE_ENV === 'production') {
cssLink = <link rel="stylesheet" href={ link('/styles.css') } />
}
2016-03-11 23:28:19 +01:00
2016-03-21 18:03:01 +01:00
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0" />
<title>
{ title }
</title>
<link rel="shortcut icon" href={ this.props.favicon } />
<link href='https://fonts.googleapis.com/css?family=Roboto:700|Raleway:600,700|PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css' />
{ cssLink }
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={ { __html: this.props.body} } />
<script src={ link('/bundle.js') } />
</body>
</html>
)
},
2016-03-11 23:28:19 +01:00
})