-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathHtml.js
More file actions
43 lines (40 loc) · 1.5 KB
/
Html.js
File metadata and controls
43 lines (40 loc) · 1.5 KB
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';
function Html({ css, js, html, head, initialState }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge,chrome=1" />
{head.title.toComponent()}
{head.meta.toComponent()}
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="msapplication-tap-highlight" content="no" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
{head.link.toComponent()}
{css ? (
<link rel="stylesheet" href={css} />
) : null}
</head>
<body>
<div id="root" dangerouslySetInnerHTML={{
__html: html
}} />
{initialState ? (
<script dangerouslySetInnerHTML={{
__html: `window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}`
}} />
) : null}
<script src={js}></script>
</body>
</html>
);
}
Html.propTypes = {
css: PropTypes.string,
js: PropTypes.string.isRequired,
html: PropTypes.string,
head: PropTypes.object.isRequired,
initialState: PropTypes.object
};
export default Html;