Skip to content

Commit

Permalink
Merge pull request #166 from wmertens/patch-1
Browse files Browse the repository at this point in the history
Strip non-<input> props
  • Loading branch information
JedWatson committed Jul 24, 2016
2 parents 42a00c1 + 4047b1e commit 4bfd3ce
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/components/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,28 @@ module.exports = React.createClass({
},

render() {
const {noedit, multiline, size, className, autofocus, ...rest} = this.props;
// classes
let className = classNames(
{
'FormInput-noedit': this.props.noedit,
'FormInput-noedit--multiline': this.props.noedit && this.props.multiline,
'FormInput': !this.props.noedit,
'FormInput-noedit': noedit,
'FormInput-noedit--multiline': noedit && multiline,
'FormInput': !noedit,
},
(this.props.size ? ('FormInput--' + this.props.size) : null),
this.props.className
(size ? ('FormInput--' + size) : null),
className
);
let props = { ...this.props, className, ref: 'input' };
let props = { ...rest, className, ref: 'input' };
let Element = 'input';
if (this.props.noedit && this.props.href) {
if (noedit && this.props.href) {
Element = 'a';
props.type = null;
props.children = props.children || props.value;
} else if (this.props.noedit) {
} else if (noedit) {
Element = 'div';
props.type = null;
props.children = props.children || props.value;
} else if (this.props.multiline) {
} else if (multiline) {
Element = 'textarea';
}

Expand Down

0 comments on commit 4bfd3ce

Please sign in to comment.