client/src/components/NoteInput.js
changeset 2 b52921a63e77
parent 1 431977d7c9a6
child 5 5c91bfa8fcde
equal deleted inserted replaced
1:431977d7c9a6 2:b52921a63e77
     1 import React, {Component} from 'react';
     1 import React, {Component} from 'react';
       
     2 
       
     3 import ReactDOM from 'react-dom'
       
     4 import { Form, FormControl, FormGroup, Button } from 'react-bootstrap';
     2 
     5 
     3 import PropTypes from 'prop-types';
     6 import PropTypes from 'prop-types';
     4 
     7 
     5 class NoteInput extends Component {
     8 class NoteInput extends Component {
     6   constructor(props) {
     9   constructor(props) {
    28     this.noteInput.focus();
    31     this.noteInput.focus();
    29   }
    32   }
    30 
    33 
    31   render() {
    34   render() {
    32     return (
    35     return (
    33       <div>
    36       <Form>
    34         <textarea
    37         <FormGroup>
    35           id="noteText"
    38           <FormControl
    36           onChange={this.handleChange}
    39               componentClass="textarea"
    37           placeholder="note"
    40               placeholder="Enter note"
    38           ref={(input) => { this.noteInput = input; }}
    41               onChange={this.handleChange}
    39         />
    42               ref={(input) => { this.noteInput = ReactDOM.findDOMNode(input); }}
    40         <button onClick={this.onAddNoteClick}>Add Note</button>
    43           />
    41       </div>
    44         </FormGroup>
       
    45         <Button type="button" onClick={this.onAddNoteClick}>Add Note</Button>
       
    46       </Form>
    42     );
    47     );
    43   }
    48   }
    44 }
    49 }
    45 
    50 
    46 NoteInput.propTypes = {
    51 NoteInput.propTypes = {