react-web-native-sketch
Version:
[TODO: We need an overview of how this can be used via npm vs as a local package]
63 lines • 2.86 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var 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 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 Popover_1 = require("@material-ui/core/Popover");
var React = require("react");
var __1 = require("../../");
var styles = {
container: {},
popover: {
width: 150,
},
};
var CPopoverComponent = /** @class */ (function (_super) {
__extends(CPopoverComponent, _super);
function CPopoverComponent(props) {
var _this = _super.call(this, props) || this;
_this.handleClick = function (event) {
event.preventDefault();
_this.anchorEl = event.currentTarget;
};
_this.handleRequestClose = function () {
_this.setState({ popOverVisible: false });
};
_this.anchorEl = null;
_this.state = {
popOverVisible: false,
};
return _this;
}
CPopoverComponent.prototype.render = function () {
var _this = this;
var _a = this.props, classes = _a.classes, children = _a.children, actions = _a.actions, containerStyle = _a.containerStyle, popOverVisible = this.state.popOverVisible, enhancedChild = React.cloneElement(children, {
onPress: function (event) {
_this.handleClick(event);
_this.setState({ popOverVisible: !popOverVisible });
}
});
return (React.createElement(__1.View, { style: [classes.container, containerStyle] },
enhancedChild,
React.createElement(Popover_1.default, { open: popOverVisible, anchorEl: this.anchorEl, anchorOrigin: { horizontal: 'left', vertical: 'bottom' }, onClose: this.handleRequestClose }, actions.map(function (action) {
return React.createElement(__1.Button, { key: "action_" + action.title,
// icon={action.icon}
// iconStyle={{ position: 'absolute', left: 0, tintColor: null, alignSelf: 'center', }}
title: action.title, onPress: function () {
action.onPress();
_this.setState({ popOverVisible: false });
} });
}))));
};
return CPopoverComponent;
}(React.PureComponent));
var componentName = 'PopoverComponent';
exports.PopoverComponent = __1.createStyles(styles, componentName)(CPopoverComponent);
//# sourceMappingURL=PopoverComponent.js.map