mirror of
https://github.com/ascribe/onion.git
synced 2025-02-03 15:47:38 +01:00
35 lines
991 B
JavaScript
35 lines
991 B
JavaScript
|
import React from 'react';
|
||
|
|
||
|
import AlertMixin from '../../mixins/alert_mixin'
|
||
|
|
||
|
let InputText = React.createClass({
|
||
|
|
||
|
mixins : [AlertMixin],
|
||
|
|
||
|
getInitialState() {
|
||
|
return {value: null,
|
||
|
alerts: null, // needed in AlertMixin
|
||
|
retry: 0 // needed in AlertMixin for generating unique alerts
|
||
|
};
|
||
|
},
|
||
|
handleChange(event) {
|
||
|
this.setState({value: event.target.value});
|
||
|
},
|
||
|
render() {
|
||
|
let className = "form-control input-text-ascribe";
|
||
|
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
||
|
return (
|
||
|
<div className="form-group">
|
||
|
{alerts}
|
||
|
<input className={className}
|
||
|
placeholder={this.props.placeHolder}
|
||
|
required={this.props.required}
|
||
|
type={this.props.type}
|
||
|
onChange={this.handleChange}/>
|
||
|
</div>
|
||
|
);
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
export default InputText;
|