"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _components = require("@patternplate/components");

var _reactDom = require("react-dom");

var _reactHelmet = _interopRequireDefault(require("react-helmet"));

var _markdown = _interopRequireDefault(require("../containers/markdown"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Documentation extends _react.default.Component {
  componentWillUpdate(nextProps) {
    const props = this.props;
    const changed = props.location.pathname !== nextProps.location.pathname;

    if (changed && typeof props.requestScroll === "function") {
      props.requestScroll((0, _reactDom.findDOMNode)(this.ref));
    }
  }

  render() {
    const props = this.props;
    return _react.default.createElement(StyledDocumentation, {
      ref: _ref => this.ref = _ref
    }, _react.default.createElement("div", {
      id: "doctop"
    }), _react.default.createElement(_reactHelmet.default, {
      title: props.displayName
    }), _react.default.createElement(_markdown.default, {
      linkable: true,
      source: props.doc,
      widgets: props.widgets
    }));
  }

}

exports.default = Documentation;

const StyledDocumentation = _components.styled.div.withConfig({
  displayName: "documentation__StyledDocumentation"
})(["box-sizing:border-box;margin:0 auto;width:100%;max-width:860px;padding:60px;"]);
//# sourceMappingURL=documentation.js.map