diff -r d076a27e5631 -r 431977d7c9a6 client/src/components/NoteInput.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/components/NoteInput.js Mon May 22 14:34:35 2017 +0200 @@ -0,0 +1,50 @@ +import React, {Component} from 'react'; + +import PropTypes from 'prop-types'; + +class NoteInput extends Component { + constructor(props) { + super(props); + + this.state = {value: ''}; + + this.onAddNoteClick = this.onAddNoteClick.bind(this); + this.handleChange = this.handleChange.bind(this); + } + + handleChange(event) { + this.setState({value : event.target.value}); + } + + onAddNoteClick(event) { + this.props.addNote(this.state.value); + + this.noteInput.value = ""; + + this.noteInput.focus(); + } + + componentDidMount() { + this.noteInput.focus(); + } + + render() { + return ( +