@atlaskit/button
Version:
A button triggers an event or action. They let users know what will happen next.
23 lines (22 loc) • 930 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getActions = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _react = require("react");
var getActions = exports.getActions = function getActions(children) {
var _Children$toArray = _react.Children.toArray(children),
_Children$toArray2 = (0, _slicedToArray2.default)(_Children$toArray, 2),
PrimaryAction = _Children$toArray2[0],
SecondaryAction = _Children$toArray2[1];
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && (!PrimaryAction || !SecondaryAction)) {
// TODO: i18n?
throw new SyntaxError('SplitButton requires two children to be provided');
}
return {
PrimaryAction: PrimaryAction,
SecondaryAction: SecondaryAction
};
};