react-toolbox/components/checkbox/Check.js

33 lines
799 B
JavaScript
Raw Normal View History

2016-04-09 21:34:34 +03:00
import React, { PropTypes } from 'react';
2016-05-21 19:42:22 +03:00
import classnames from 'classnames';
import { themr } from 'react-css-themr';
2015-12-07 04:34:12 +03:00
import Ripple from '../ripple';
2016-05-21 19:42:22 +03:00
const Check = ({checked, children, onMouseDown, theme}) => (
<div
data-react-toolbox='check'
className={classnames(theme.check, { [theme.checked]: checked })}
onMouseDown={onMouseDown}
>
{children}
</div>
);
2016-04-09 21:34:34 +03:00
Check.propTypes = {
checked: PropTypes.bool,
children: PropTypes.any,
2016-05-21 19:42:22 +03:00
onMouseDown: PropTypes.func,
theme: React.PropTypes.shape({
check: React.PropTypes.string.isRequired,
checked: React.PropTypes.string.isRequired
})
2016-04-09 21:34:34 +03:00
};
2016-05-21 19:42:22 +03:00
const RawCheck = themr('ToolboxCheckbox')(Check);
export default themr('ToolboxCheckbox')(Ripple({
spread: 2.6,
centered: true
2016-05-21 19:42:22 +03:00
})(Check));
export {RawCheck as RawCheck};