Renaming field to control (#2210)

This commit is contained in:
Maxime Beauchemin
2017-02-22 08:36:47 -08:00
committed by GitHub
parent d5ba88b407
commit 1e47d6fb41
30 changed files with 415 additions and 411 deletions

View File

@@ -0,0 +1,32 @@
import React, { PropTypes } from 'react';
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;