Use ClassNames in Checkbox component

old
Javi Velasco 2015-11-28 13:42:17 +01:00
parent 387afcf6fd
commit 50544ab413
1 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import React from 'react';
import ClassNames from 'classnames';
import Ripple from '../ripple';
import events from '../utils/events';
import style from './style';
@ -48,11 +49,13 @@ class Checkbox extends React.Component {
}
render () {
let fieldClassName = style.field;
let checkboxClassName = style.check;
if (this.props.checked) checkboxClassName += ` ${style.checked}`;
if (this.props.disabled) fieldClassName += ` ${style.disabled}`;
if (this.props.className) fieldClassName += ` ${this.props.className}`;
const fieldClassName = ClassNames(style.field, {
[style.disabled]: this.props.disabled
}, this.props.className);
const checkboxClassName = ClassNames(style.check, {
[style.checked]: this.props.checked
});
return (
<label