'use strict';

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

var _class, _temp;

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _style = require('./style');

var _style2 = _interopRequireDefault(_style);

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

let StorybookView = (_temp = _class = 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 _react2.default.createElement(
      'div',
      { style: _style2.default.main },
      children
    );
  }
}, _class.propTypes = {
  children: _propTypes2.default.node
}, _class.defaultProps = {
  children: null
}, _temp);
exports.default = StorybookView;


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