organism-react-i13n
Version:
67 lines (54 loc) • 2.09 kB
JavaScript
import _objectWithoutPropertiesLoose from "reshow-runtime/es/helpers/objectWithoutPropertiesLoose";
import _classCallCheck from "reshow-runtime/es/helpers/classCallCheck";
import _createClass from "reshow-runtime/es/helpers/createClass";
import _assertThisInitialized from "reshow-runtime/es/helpers/assertThisInitialized";
import _inherits from "reshow-runtime/es/helpers/inherits";
import _createSuper from "reshow-runtime/es/helpers/createSuper";
import _defineProperty from "reshow-runtime/es/helpers/defineProperty";
var _excluded = ["component", "onClick", "I13N"];
import React, { PureComponent } from "react";
import { build, SemanticUI } from "react-atomic-molecule";
import callfunc from "call-func";
import { i13nDispatch } from "../../src/index.mjs";
var I13nClick = /*#__PURE__*/function (_PureComponent) {
_inherits(I13nClick, _PureComponent);
var _super = _createSuper(I13nClick);
function I13nClick() {
var _this;
_classCallCheck(this, I13nClick);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
var _this$props = _this.props,
onClick = _this$props.onClick,
I13N = _this$props.I13N;
callfunc(onClick, [e]);
i13nDispatch({
type: "action",
params: {
I13N: I13N
}
});
});
return _this;
}
_createClass(I13nClick, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
component = _this$props2.component,
onClick = _this$props2.onClick,
I13N = _this$props2.I13N,
others = _objectWithoutPropertiesLoose(_this$props2, _excluded);
others.onClick = this.handleClick;
return build(component)(others);
}
}]);
return I13nClick;
}(PureComponent);
_defineProperty(I13nClick, "defaultProps", {
component: SemanticUI
});
export default I13nClick;