react-toolbox/components/checkbox/Check.js

33 lines
752 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
2016-05-21 19:42:22 +03:00
import classnames from 'classnames';
2017-01-26 20:05:32 +03:00
import styleShape from 'react-style-proptype';
2016-05-29 13:38:20 +03:00
const factory = (ripple) => {
2017-01-26 20:05:32 +03:00
const Check = ({ checked, children, onMouseDown, theme, style }) => (
2016-05-29 13:38:20 +03:00
<div
2017-01-26 20:05:32 +03:00
data-react-toolbox="check"
2016-05-29 13:38:20 +03:00
className={classnames(theme.check, { [theme.checked]: checked })}
onMouseDown={onMouseDown}
style={style}
2016-05-29 13:38:20 +03:00
>
{children}
</div>
);
2016-05-29 13:38:20 +03:00
Check.propTypes = {
checked: PropTypes.bool,
2017-01-26 20:05:32 +03:00
children: PropTypes.node,
2016-05-29 13:38:20 +03:00
onMouseDown: PropTypes.func,
2017-01-26 20:05:32 +03:00
style: styleShape,
theme: PropTypes.shape({
check: PropTypes.string,
2017-01-26 20:05:32 +03:00
checked: PropTypes.string,
}),
2016-05-29 13:38:20 +03:00
};
2016-04-09 21:34:34 +03:00
2016-05-29 13:38:20 +03:00
return ripple(Check);
};
2016-05-21 19:42:22 +03:00
2016-05-29 13:38:20 +03:00
export default factory;