cf-component-button
Advanced tools
Comparing version 2.2.2 to 2.2.3
'use strict'; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes; | ||
function Button(props) { | ||
var disabled = props.disabled; | ||
var loading = props.loading; | ||
var Button = function (_React$Component) { | ||
_inherits(Button, _React$Component); | ||
var type = props.submit ? 'submit' : 'button'; | ||
var className = 'cf-btn cf-btn--' + props.type; | ||
function Button() { | ||
_classCallCheck(this, Button); | ||
if (loading) { | ||
className += ' cf-btn--loading'; | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
} | ||
// Unless the disabled state is explicitly set, the button is disabled when loading. | ||
var isDisabled = (disabled !== undefined ? disabled : loading) || false; | ||
Button.prototype.render = function render() { | ||
var _props = this.props; | ||
var disabled = _props.disabled; | ||
var loading = _props.loading; | ||
return React.createElement( | ||
'button', | ||
{ | ||
type: type, | ||
className: className, | ||
disabled: isDisabled, | ||
onClick: props.onClick }, | ||
props.children | ||
); | ||
} | ||
var type = this.props.submit ? 'submit' : 'button'; | ||
var className = 'cf-btn cf-btn--' + this.props.type; | ||
if (loading) { | ||
className += ' cf-btn--loading'; | ||
} | ||
// Unless the disabled state is explicitly set, the button is disabled when loading. | ||
var isDisabled = (disabled !== undefined ? disabled : loading) || false; | ||
return React.createElement( | ||
'button', | ||
{ | ||
type: type, | ||
className: className, | ||
disabled: isDisabled, | ||
onClick: this.props.onClick }, | ||
this.props.children | ||
); | ||
}; | ||
return Button; | ||
}(React.Component); | ||
Button.propTypes = { | ||
@@ -32,0 +51,0 @@ onClick: PropTypes.func.isRequired, |
'use strict'; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var React = require('react'); | ||
function ButtonGroup(props) { | ||
return React.createElement( | ||
'div', | ||
{ className: 'cf-btn__group' }, | ||
props.children | ||
); | ||
} | ||
var ButtonGroup = function (_React$Component) { | ||
_inherits(ButtonGroup, _React$Component); | ||
function ButtonGroup() { | ||
_classCallCheck(this, ButtonGroup); | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
} | ||
ButtonGroup.prototype.render = function render() { | ||
return React.createElement( | ||
'div', | ||
{ className: 'cf-btn__group' }, | ||
this.props.children | ||
); | ||
}; | ||
return ButtonGroup; | ||
}(React.Component); | ||
; | ||
module.exports = ButtonGroup; |
{ | ||
"name": "cf-component-button", | ||
"description": "CloudFlare Button Component", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "author": "James Kyle <jkyle@cloudflare.com>", |
5036
72