mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 17:45:10 +01:00
509aa111ab
Conflicts: gulpfile.js added notifications cleaned up proptypes
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
import React from 'react';
|
|
|
|
import AlertMixin from '../../mixins/alert_mixin';
|
|
|
|
let InputTextArea = React.createClass({
|
|
propTypes: {
|
|
submitted: React.PropTypes.bool,
|
|
required: React.PropTypes.string,
|
|
defaultValue: React.PropTypes.string
|
|
},
|
|
|
|
mixins: [AlertMixin],
|
|
|
|
getInitialState() {
|
|
return {
|
|
value: this.props.defaultValue,
|
|
alerts: null // needed in AlertMixin
|
|
};
|
|
},
|
|
handleChange(event) {
|
|
this.setState({value: event.target.value});
|
|
},
|
|
render() {
|
|
let className = 'form-control input-text-ascribe textarea-ascribe-message';
|
|
|
|
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
|
return (
|
|
<div className="form-group">
|
|
{alerts}
|
|
<textarea className={className}
|
|
defaultValue={this.props.defaultValue}
|
|
required={this.props.required}
|
|
onChange={this.handleChange}></textarea>
|
|
</div>
|
|
);
|
|
}
|
|
});
|
|
|
|
export default InputTextArea; |