Skip to content

Commit

Permalink
Apply Checkbox style property to internal .check
Browse files Browse the repository at this point in the history
This will allow you to override the styles of the visible check element
instead of the hidden input element.

This fixes #791.
  • Loading branch information
stianjensen committed Sep 27, 2016
1 parent 68e4b53 commit 2ce1d4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions components/checkbox/Check.js
Expand Up @@ -2,11 +2,12 @@ import React, { PropTypes } from 'react';
import classnames from 'classnames';

const factory = (ripple) => {
const Check = ({checked, children, onMouseDown, theme}) => (
const Check = ({checked, children, onMouseDown, theme, style}) => (
<div
data-react-toolbox='check'
className={classnames(theme.check, { [theme.checked]: checked })}
onMouseDown={onMouseDown}
style={style}
>
{children}
</div>
Expand All @@ -19,7 +20,8 @@ const factory = (ripple) => {
theme: PropTypes.shape({
check: PropTypes.string,
checked: PropTypes.string
})
}),
style: PropTypes.object
};

return ripple(Check);
Expand Down
3 changes: 2 additions & 1 deletion components/checkbox/Checkbox.js
Expand Up @@ -47,7 +47,7 @@ const factory = (Check) => {
}

render () {
const { onChange, theme, ...others } = this.props; //eslint-disable-line no-unused-vars
const { onChange, theme, style, ...others } = this.props; //eslint-disable-line no-unused-vars
const className = classnames(theme.field, {
[theme.disabled]: this.props.disabled
}, this.props.className);
Expand All @@ -66,6 +66,7 @@ const factory = (Check) => {
checked={this.props.checked}
disabled={this.props.disabled}
rippleClassName={theme.ripple}
style={style}
theme={this.props.theme}
/>
{this.props.label ? <span data-react-toolbox='label' className={theme.text}>{this.props.label}</span> : null}
Expand Down

0 comments on commit 2ce1d4c

Please sign in to comment.