codogo-react-widgets
Version:
Provides a unified way to access the styling of commonly used widgets across different apps
66 lines (48 loc) • 2.95 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _taggedTemplateLiteral2 = require("babel-runtime/helpers/taggedTemplateLiteral");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _templateObject = (0, _taggedTemplateLiteral3.default)(["\n\tbackground-color: white;\n\tborder-radius: 4px ;\n\theight: 40px;\n\tmargin: 4px;\n\tpadding: 4px;\n\twidth: 40px;\n"], ["\n\tbackground-color: white;\n\tborder-radius: 4px ;\n\theight: 40px;\n\tmargin: 4px;\n\tpadding: 4px;\n\twidth: 40px;\n"]),
_templateObject2 = (0, _taggedTemplateLiteral3.default)(["\n\tquery getUserID {\n\t\tviewer{\n\t\t\tuser {\n\t\t\t\tid\n\t\t\t}\n\t\t}\n\t}\n"], ["\n\tquery getUserID {\n\t\tviewer{\n\t\t\tuser {\n\t\t\t\tid\n\t\t\t}\n\t\t}\n\t}\n"]),
_templateObject3 = (0, _taggedTemplateLiteral3.default)(["\n\tmutation CreateNewOrg($myID: ID!) {\n\t\tcreateOrg(input: { ownerId: $myID name: \"New Org\" }) {\n\t\t\tchangedOrg {\n\t\t\t\tid\n\t\t\t\timage {\n\t\t\t\t\turi\n\t\t\t\t\tcloudinaryID\n\t\t\t\t}\n\t\t\t\towner {\n\t\t\t\t\tid\n\t\t\t\t\towns {\n\t\t\t\t\t\tedges {\n\t\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"], ["\n\tmutation CreateNewOrg($myID: ID!) {\n\t\tcreateOrg(input: { ownerId: $myID name: \"New Org\" }) {\n\t\t\tchangedOrg {\n\t\t\t\tid\n\t\t\t\timage {\n\t\t\t\t\turi\n\t\t\t\t\tcloudinaryID\n\t\t\t\t}\n\t\t\t\towner {\n\t\t\t\t\tid\n\t\t\t\t\towns {\n\t\t\t\t\t\tedges {\n\t\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"]);
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _ramda = require("ramda");
var _ramda2 = _interopRequireDefault(_ramda);
var _styledComponents = require("styled-components");
var _styledComponents2 = _interopRequireDefault(_styledComponents);
var _reactApollo = require("react-apollo");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//------------------------------
var OrgImage = _styledComponents2.default.div(_templateObject);
var getUserID = (0, _reactApollo.gql)(_templateObject2);
var createNewOrg = (0, _reactApollo.gql)(_templateObject3);
exports.default = (0, _reactApollo.compose)((0, _reactApollo.graphql)(getUserID, {
name: "getUserID"
}), (0, _reactApollo.graphql)(createNewOrg, {
props: function props(_ref) {
var mutate = _ref.mutate;
return {
addNew: function addNew(myID) {
return mutate({
variables: {
myID: myID
}
});
}
};
}
}))(function (props) {
return _ramda2.default.path(["getUserID", "viewer", "user", "id"], props) ? _react2.default.createElement(
OrgImage,
{
onClick: function onClick() {
return props.addNew(props.getUserID.viewer.user.id);
}
},
"Add new"
) : null;
});
//# sourceMappingURL=addNewButton.js.map