2017-04-17 17:14:17 +03:00
|
|
|
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';
|
2015-12-06 16:35:10 +03:00
|
|
|
|
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}
|
2016-09-27 16:28:26 +03:00
|
|
|
style={style}
|
2016-05-29 13:38:20 +03:00
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
2015-12-06 16:35:10 +03:00
|
|
|
|
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,
|
2016-06-04 00:44:33 +03:00
|
|
|
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;
|