UNPKG

cuz

Version:

Front-end modular development kit.

33 lines (28 loc) 717 B
import React from 'react'; import Input from '../Input'; const Checkbox = React.createClass({ propTypes: { onSelect: React.PropTypes.func, onChange: React.PropTypes.func, children: React.PropTypes.any, value: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]), }, handleChange(event) { const { onSelect, onChange, value } = this.props; if (onSelect) onSelect(value, event); if (onChange) onChange(event, this.props); }, render() { const { children, ...props } = this.props; return ( <Input label={ children } { ...props } onChange={this.handleChange} /> ); } }); export default Checkbox;