1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Property component now propagate its name to its input child

This commit is contained in:
vrde 2015-10-14 15:30:10 +02:00
parent 7af4e0912e
commit 01cea9ad3d
2 changed files with 10 additions and 4 deletions

View File

@ -17,11 +17,13 @@ let InputCheckbox = React.createClass({
//
// Since this component even has checkbox in its name, it felt wrong to expose defaultValue
// as the default-setting prop to other developers, which is why we choose defaultChecked.
defaultValue: React.PropTypes.string,
defaultChecked: React.PropTypes.bool,
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element
]),
name: React.PropTypes.string,
// provided by Property
disabled: React.PropTypes.bool,
@ -102,8 +104,10 @@ let InputCheckbox = React.createClass({
return (
<span
style={this.props.style}
onClick={this.onChange}>
onClick={this.onChange}
name={this.props.name}>
<input
name={this.props.name}
type="checkbox"
ref="checkbox"
onChange={this.onChange}

View File

@ -31,6 +31,7 @@ let Property = React.createClass({
footer: React.PropTypes.element,
handleChange: React.PropTypes.func,
ignoreFocus: React.PropTypes.bool,
name: React.PropTypes.string.isRequired,
className: React.PropTypes.string,
onClick: React.PropTypes.func,
@ -210,7 +211,8 @@ let Property = React.createClass({
onFocus: this.handleFocus,
onBlur: this.handleBlur,
disabled: !this.props.editable,
ref: 'input'
ref: 'input',
name: this.props.name
});
});
},