All files / javascripts/explorev2/components TextAreaField.jsx

0% Statements 0/10
100% Branches 0/0
0% Functions 0/2
0% Lines 0/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
import React, { PropTypes } from 'react';
import { FormGroup, FormControl } from 'react-bootstrap';
import ControlLabelWithTooltip from './ControlLabelWithTooltip';
 
const propTypes = {
  name: PropTypes.string.isRequired,
  label: PropTypes.string,
  description: PropTypes.string,
  onChange: PropTypes.func,
  value: PropTypes.string,
};
 
const defaultProps = {
  label: null,
  description: null,
  onChange: () => {},
  value: '',
};
 
export default class TextAreaField extends React.Component {
  onChange(event) {
    this.props.onChange(this.props.name, event.target.value);
  }
  render() {
    return (
      <FormGroup controlId="formControlsTextarea">
        <ControlLabelWithTooltip label={this.props.label} description={this.props.description} />
        <FormControl
          componentClass="textarea"
          placeholder="textarea"
          onChange={this.onChange.bind(this)}
          value={this.props.value}
        />
      </FormGroup>
    );
  }
}
 
TextAreaField.propTypes = propTypes;
TextAreaField.defaultProps = defaultProps;