UNPKG

@tdb/web

Version:

Common condiguration for serving a web-site and testing web-based UI components.

44 lines 2.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var common_1 = require("../common"); var next = require("../server/document"); next.fastClick(); var MyDocument = (function (_super) { tslib_1.__extends(MyDocument, _super); function MyDocument() { return _super !== null && _super.apply(this, arguments) || this; } MyDocument.getInitialProps = function (args) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, res, browser, isDev, options, page; return tslib_1.__generator(this, function (_a) { req = args.req, res = args.res; browser = next.browser(args); if (req.url !== '/browser' && browser.msie) { return [2, res.redirect('/browser')]; } isDev = next.isDev(args); options = { isDev: isDev }; page = next.renderCss(args); return [2, tslib_1.__assign({}, page, options)]; }); }); }; MyDocument.prototype.render = function () { var props = this.props; return (common_1.React.createElement("html", null, common_1.React.createElement(next.Head, null, common_1.React.createElement("meta", { name: 'viewport', content: 'width=device-width, initial-scale=1' }), common_1.React.createElement("link", { rel: 'icon', type: 'image/x-icon', href: "/favicon.ico" }), common_1.React.createElement(next.Stylesheet, { href: "/css/normalize.css" }), common_1.React.createElement(next.Stylesheet, { href: "/css/global.css" }), common_1.React.createElement("style", { dangerouslySetInnerHTML: { __html: props.css } })), common_1.React.createElement("body", null, common_1.React.createElement(next.Main, null), common_1.React.createElement(next.NextScript, null)))); }; return MyDocument; }(next.Document)); exports.default = MyDocument; //# sourceMappingURL=_document.js.map