Files
superset2/superset/assets/javascripts/explorev2/components/controls/CheckboxControl.jsx
Maxime Beauchemin e055e6d2c2 Fixing PropTypes warning messages (#2670)
* Fixing PropTypes warning message

React recently started warning on the upcoming deprecation of
React.PropTypes, the new approach is to use the `prop-types`
npm package instead.

* Fixing the tests
2017-04-24 17:39:57 -07:00

34 lines
701 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { Checkbox } from 'react-bootstrap';
const propTypes = {
name: PropTypes.string.isRequired,
value: PropTypes.bool,
label: PropTypes.string,
description: PropTypes.string,
onChange: PropTypes.func,
};
const defaultProps = {
value: false,
onChange: () => {},
};
export default class CheckboxControl extends React.Component {
onToggle() {
this.props.onChange(!this.props.value);
}
render() {
return (
<Checkbox
checked={this.props.value}
onChange={this.onToggle.bind(this)}
/>
);
}
}
CheckboxControl.propTypes = propTypes;
CheckboxControl.defaultProps = defaultProps;