-
Notifications
You must be signed in to change notification settings - Fork 20
/
MainPage.js
43 lines (38 loc) · 1.48 KB
/
MainPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { PropTypes } from 'react'
class HomePage extends React.Component {
static propTypes = {
title: PropTypes.string,
webpackManifest: PropTypes.object,
styles: PropTypes.arrayOf(PropTypes.string),
scripts: PropTypes.arrayOf(PropTypes.string)
}
static defaultProps = {
title: 'web-starter',
webpackManifest: {},
styles: [],
scripts: []
}
render() {
const { title, webpackManifest, styles, scripts } = this.props
return (
<html>
<head>
<meta charSet="utf-8"/>
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<meta name="timestamp" content={(new Date).toISOString()}/>
<title>{title}</title>
<script dangerouslySetInnerHTML={{ __html: "window.Promise || document.write('\\x3Cscript src=\"/es6-promise.min.js\">\\x3C/script>\\x3Cscript>ES6Promise.polyfill()\\x3C/script>')" }}/>
<script dangerouslySetInnerHTML={{ __html: "window.fetch || document.write('\\x3Cscript src=\"/fetch.min.js\">\\x3C/script>')" }}/>
<script dangerouslySetInnerHTML={{ __html: "window.webpackManifest = " + JSON.stringify(webpackManifest) }}/>
{styles.map(s => <link rel="stylesheet" key={s} href={s}/>)}
</head>
<body>
<div id="app"/>
{scripts.map(s => <script key={s} src={s}/>)}
</body>
</html>
)
}
}
export default HomePage