Skip to content

Instantly share code, notes, and snippets.

@JayBee007
Created June 22, 2017 18:59
Show Gist options
  • Select an option

  • Save JayBee007/39d449b5a43ce31ffb2fe9c772a2c868 to your computer and use it in GitHub Desktop.

Select an option

Save JayBee007/39d449b5a43ce31ffb2fe9c772a2c868 to your computer and use it in GitHub Desktop.
render() {
const { title, description, styles, scripts, state, children } = this.props;
return (
<html className="no-js" lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{title}</title>
<meta name="description" content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="/material.min.css" />
<link rel="stylesheet" href="/react-select.min.css" />
<link rel="stylesheet" href="node_modules/react-material-datetimepicker/build/react-material-datetime-picker.css" />
{styles.map(style =>
<style
key={style.id}
id={style.id}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: style.cssText }}
/>,
)}
</head>
<body>
<div
id="app"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: children }}
/>
{state && (
<script
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html:
`window.APP_STATE=${serialize(state, { isJSON: true })}` }}
/>
)}
{scripts.map(script => <script key={script} src={script} />)}
{analytics.google.trackingId &&
<script
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html:
'window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;' +
`ga('create','${analytics.google.trackingId}','auto');ga('send','pageview')` }}
/>
}
{analytics.google.trackingId &&
<script src="https://www.google-analytics.com/analytics.js" async defer />
}
<script src="https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js" />
</body>
</html>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment