2016-10-26 20:02:59 +03:00
|
|
|
const classNames = require('classnames');
|
|
|
|
const React = require('react');
|
|
|
|
const styles = require('./style.css');
|
|
|
|
|
|
|
|
const Radio = ({
|
|
|
|
name,
|
|
|
|
value,
|
2016-10-27 12:51:47 +03:00
|
|
|
children,
|
2016-10-26 20:02:59 +03:00
|
|
|
checked,
|
|
|
|
disabled = false,
|
|
|
|
className,
|
|
|
|
id,
|
|
|
|
onChange,
|
|
|
|
style
|
|
|
|
}) => {
|
|
|
|
|
|
|
|
const cn = classNames(
|
|
|
|
className,
|
|
|
|
styles.radio
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2016-10-27 12:51:47 +03:00
|
|
|
<label className={cn} htmlFor={id}>
|
2016-10-26 20:02:59 +03:00
|
|
|
<input
|
|
|
|
checked={checked}
|
2016-10-27 12:51:47 +03:00
|
|
|
disabled={disabled}
|
|
|
|
id={id}
|
|
|
|
name={name}
|
2016-10-26 20:02:59 +03:00
|
|
|
onChange={onChange}
|
2016-10-27 12:51:47 +03:00
|
|
|
type='radio'
|
|
|
|
value={value}
|
2016-10-26 20:02:59 +03:00
|
|
|
/>
|
2016-10-27 12:51:47 +03:00
|
|
|
<span>{children}</span>
|
2016-10-26 20:02:59 +03:00
|
|
|
</label>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
Radio.propTypes = {
|
2016-10-27 12:51:47 +03:00
|
|
|
checked: React.PropTypes.bool,
|
|
|
|
children: React.PropTypes.node,
|
2016-10-26 20:02:59 +03:00
|
|
|
className: React.PropTypes.string,
|
2016-10-27 12:51:47 +03:00
|
|
|
disabled: React.PropTypes.bool,
|
|
|
|
id: React.PropTypes.string,
|
2016-10-26 20:02:59 +03:00
|
|
|
name: React.PropTypes.string,
|
2016-10-27 12:51:47 +03:00
|
|
|
onChange: React.PropTypes.func,
|
|
|
|
style: React.PropTypes.object,
|
|
|
|
value: React.PropTypes.string
|
2016-10-26 20:02:59 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Radio;
|