@miksu/react-tiny-popover
Version:
A simple and highly customizable popover react higher order component with no other dependencies! Typescript friendly.
36 lines • 1.42 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_dom_1 = require("react-dom");
var Portal = /** @class */ (function (_super) {
__extends(Portal, _super);
function Portal(props) {
return _super.call(this, props) || this;
}
Portal.prototype.componentDidMount = function () {
this.props.container.appendChild(this.props.element);
};
Portal.prototype.componentWillUnmount = function () {
this.props.container.removeChild(this.props.element);
};
Portal.prototype.render = function () {
var children = this.props.children;
return react_dom_1.createPortal(children, this.props.element);
};
return Portal;
}(React.PureComponent));
exports.Portal = Portal;
//# sourceMappingURL=Portal.js.map