Javi Velasco 2017-01-21 12:47:21 +01:00
parent cee3fb25ad
commit 52f6c4adab
2 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ const factory = (Thumb) => {
onBlur: PropTypes.func,
onChange: PropTypes.func,
onFocus: PropTypes.func,
ripple: PropTypes.bool,
theme: PropTypes.shape({
disabled: PropTypes.string,
field: PropTypes.string,
@ -50,7 +51,7 @@ const factory = (Thumb) => {
}
render () {
const { className, checked, disabled, onChange, theme, ...others } = this.props; //eslint-disable-line no-unused-vars
const { className, checked, ripple, disabled, onChange, theme, ...others } = this.props; //eslint-disable-line no-unused-vars
const _className = classnames(theme[disabled ? 'disabled' : 'field'], className);
return (
<label data-react-toolbox='switch' className={_className}>
@ -64,7 +65,7 @@ const factory = (Thumb) => {
type='checkbox'
/>
<span className={theme[checked ? 'on' : 'off']}>
<Thumb disabled={this.props.disabled} theme={theme} />
<Thumb disabled={this.props.disabled} theme={theme} ripple={ripple} />
</span>
{this.props.label ? <span className={theme.text}>{this.props.label}</span> : null}
</label>

View File

@ -56,6 +56,7 @@ This component can be styled by context providing a theme with the key `RTSwitch
| `onBlur` | `Function` | | Callback function that is fired when when the switch is blurred.|
| `onChange` | `Function` | | Callback function that is fired when the component's value changes.|
| `onFocus` | `Function` | | Callback function that is fired when the switch is focused.|
| `ripple` | `Boolean` | | If true, the ripple effect will be disabled.|
## Theme