mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
2cdd4761c8
* Add digest auth and response timeline * Some css fixes * Fixed Button * More auth methods, fixed URL regex, and fix gzip * Get rid of negotiate auth * Fix proxy * Fixed GA tracking * Some very small changes and fixes * Fix content type names * Even better auth switching and timeline syntax * Some auth tweaks * CSS tweaks * Reworked toasts * Fixed timer rounding quirk * Request settings and render errors * Fixed tests * Vertical dragging and stuff * Remove beta
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
import React, {PureComponent, PropTypes} from 'react';
|
|
import autobind from 'autobind-decorator';
|
|
|
|
@autobind
|
|
class Button extends PureComponent {
|
|
_handleClick (e) {
|
|
const {onClick, onDisabledClick, disabled} = this.props;
|
|
const fn = disabled ? onDisabledClick : onClick;
|
|
|
|
if (this.props.hasOwnProperty('value')) {
|
|
fn && fn(this.props.value, e);
|
|
} else {
|
|
fn && fn(e);
|
|
}
|
|
}
|
|
|
|
render () {
|
|
const {
|
|
children,
|
|
disabled,
|
|
tabIndex,
|
|
className,
|
|
type
|
|
} = this.props;
|
|
|
|
return (
|
|
<button disabled={disabled}
|
|
type={type}
|
|
tabIndex={tabIndex}
|
|
className={className}
|
|
onClick={this._handleClick}>
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|
|
}
|
|
|
|
Button.propTypes = {
|
|
// Required
|
|
children: PropTypes.node.isRequired,
|
|
|
|
// Optional
|
|
value: PropTypes.any,
|
|
className: PropTypes.string,
|
|
onDisabledClick: PropTypes.func,
|
|
onClick: PropTypes.func,
|
|
disabled: PropTypes.bool,
|
|
tabIndex: PropTypes.number,
|
|
type: PropTypes.string
|
|
};
|
|
|
|
export default Button;
|