UNPKG

3.22 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = Object.setPrototypeOf ||
4 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6 return function (d, b) {
7 extendStatics(d, b);
8 function __() { this.constructor = d; }
9 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10 };
11})();
12var __assign = (this && this.__assign) || Object.assign || function(t) {
13 for (var s, i = 1, n = arguments.length; i < n; i++) {
14 s = arguments[i];
15 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
16 t[p] = s[p];
17 }
18 return t;
19};
20Object.defineProperty(exports, "__esModule", { value: true });
21var React = require("react");
22var Document = /** @class */ (function (_super) {
23 __extends(Document, _super);
24 function Document() {
25 return _super !== null && _super.apply(this, arguments) || this;
26 }
27 Document.getInitialProps = function (_a) {
28 var assets = _a.assets, data = _a.data, renderPage = _a.renderPage;
29 var page = renderPage();
30 return __assign({ assets: assets, data: data }, page);
31 };
32 Document.prototype.render = function () {
33 var _a = this.props, helmet = _a.helmet, assets = _a.assets, data = _a.data;
34 // get attributes from React Helmet
35 var htmlAttrs = helmet.htmlAttributes.toComponent();
36 var bodyAttrs = helmet.bodyAttributes.toComponent();
37 return (React.createElement("html", __assign({}, htmlAttrs),
38 React.createElement("head", null,
39 React.createElement("meta", { httpEquiv: "X-UA-Compatible", content: "IE=edge" }),
40 React.createElement("meta", { charSet: "utf-8" }),
41 React.createElement("title", null, "Welcome to the Afterparty"),
42 React.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
43 helmet.title.toComponent(),
44 helmet.meta.toComponent(),
45 helmet.link.toComponent(),
46 assets.client.css && (React.createElement("link", { rel: "stylesheet", href: assets.client.css }))),
47 React.createElement("body", __assign({}, bodyAttrs),
48 React.createElement(AfterRoot, null),
49 React.createElement(AfterData, { data: data }),
50 React.createElement("script", { type: "text/javascript", src: assets.client.js, defer: true, crossOrigin: "anonymous" }))));
51 };
52 return Document;
53}(React.Component));
54exports.Document = Document;
55function AfterRoot() {
56 return React.createElement("div", { id: "root" }, "DO_NOT_DELETE_THIS_YOU_WILL_BREAK_YOUR_APP");
57}
58exports.AfterRoot = AfterRoot;
59function AfterData(_a) {
60 var data = _a.data;
61 return (React.createElement("script", { id: "server-app-state", type: "application/json", dangerouslySetInnerHTML: {
62 __html: JSON.stringify(__assign({}, data)).replace(/<\/script>/g, '%3C/script%3E'),
63 } }));
64}
65exports.AfterData = AfterData;
66//# sourceMappingURL=Document.js.map
\No newline at end of file