UNPKG

2.76 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
9var _react = require('react');
10
11var _react2 = _interopRequireDefault(_react);
12
13var _propTypes = require('prop-types');
14
15var _propTypes2 = _interopRequireDefault(_propTypes);
16
17function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
21function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
22
23function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // eslint-disable-line no-unused-vars
24
25
26var Content = function (_Component) {
27 _inherits(Content, _Component);
28
29 function Content() {
30 _classCallCheck(this, Content);
31
32 return _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).apply(this, arguments));
33 }
34
35 _createClass(Content, [{
36 key: 'componentDidMount',
37 value: function componentDidMount() {
38 this.props.contentDidMount();
39 }
40 }, {
41 key: 'componentDidUpdate',
42 value: function componentDidUpdate() {
43 this.props.contentDidUpdate();
44 }
45 }, {
46 key: 'render',
47 value: function render() {
48 return _react.Children.only(this.props.children);
49 }
50 }]);
51
52 return Content;
53}(_react.Component);
54
55Content.propTypes = {
56 children: _propTypes2.default.element.isRequired,
57 contentDidMount: _propTypes2.default.func.isRequired,
58 contentDidUpdate: _propTypes2.default.func.isRequired
59};
60exports.default = Content;
\No newline at end of file