From 2664eb3e474f5d03d1782c15673b774d68fb2c58 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 28 May 2018 13:06:54 +0200 Subject: textInput/fileUpload --- app/client/common/textInput.component.js | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 app/client/common/textInput.component.js (limited to 'app/client/common/textInput.component.js') diff --git a/app/client/common/textInput.component.js b/app/client/common/textInput.component.js new file mode 100644 index 0000000..b3c4866 --- /dev/null +++ b/app/client/common/textInput.component.js @@ -0,0 +1,34 @@ +import { h, Component } from 'preact' + +class TextInput extends Component { + constructor(props){ + super(props) + this.handleInput = this.handleInput.bind(this) + this.handleKeydown = this.handleKeydown.bind(this) + } + handleInput(e){ + this.props.onInput && this.props.onInput(e.target.value) + } + handleKeydown(e){ + if (e.keyCode === 13) { + this.props.onSave && this.props.onSave(e.target.value) + } + } + render() { + return ( +
+ +
+ ) + } +} + +export default TextInput -- cgit v1.2.3-70-g09d2