"use strict";

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

var _propTypes = _interopRequireDefault(require("prop-types"));

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

var _style = _interopRequireDefault(require("./style"));

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

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

class StorybookView extends _react.Component {
  componentWillMount() {
    // eslint-disable-next-line global-require
    const rootStyle = require('~/../web/styles/root.scss?root=./web/styles/');

    this.removeCss = insertCss(rootStyle);
  }

  componentWillUnmount() {
    if (this.removeCss) this.removeCss();
  }

  render() {
    const children = this.props.children;
    return _react.default.createElement("div", {
      style: _style.default.main
    }, children);
  }

}

exports.default = StorybookView;
StorybookView.propTypes = {
  children: _propTypes.default.node
};
StorybookView.defaultProps = {
  children: null
};

function insertCss(...styles) {
  const removeCss = styles.map(style => style._insertCss());
  return () => removeCss.forEach(f => f());
}