"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
            t[p[i]] = s[p[i]];
    return t;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const sc = __importStar(require("./styles"));
const appTitle = 'Polymath';
class Page extends react_1.Component {
    componentWillMount() {
        this.update(this.props);
        if (typeof window !== 'undefined' && this.props.scrollToTopOnMount) {
            window.scrollTo(0, 0);
        }
    }
    componentDidUpdate() {
        this.update(this.props);
    }
    update(props) {
        document.title = props.title ? `${props.title} | ${appTitle}` : appTitle;
    }
    render() {
        const _a = this.props, { children, title } = _a, props = __rest(_a, ["children", "title"]);
        return (react_1.default.createElement(sc.Wrapper, Object.assign({ py: "xl" }, props), children));
    }
}
Page.defaultProps = {
    scrollToTopOnMount: true,
};
exports.Page = Page;
//# sourceMappingURL=Page.js.map