UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

32 lines 1.05 kB
import { __extends } from "tslib"; import React from 'react'; import PropTypes from 'prop-types'; var default_1 = /** @class */ (function (_super) { __extends(default_1, _super); function default_1() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { visible: true, }; _this.remount = function () { return new Promise(function (resolve) { return _this.setState({ visible: false }, function () { return _this.setState({ visible: true }, resolve); }); }); }; return _this; } default_1.prototype.componentDidMount = function () { window.story = this; }; default_1.prototype.render = function () { return this.state.visible ? this.props.children : null; }; default_1.propTypes = { children: PropTypes.node, }; return default_1; }(React.Component)); export default default_1; //# sourceMappingURL=RemountHoc.js.map