diff options
Diffstat (limited to 'ui/app/components/editable-label.js')
-rw-r--r-- | ui/app/components/editable-label.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js index 41c129d4e..303c49c44 100644 --- a/ui/app/components/editable-label.js +++ b/ui/app/components/editable-label.js @@ -5,46 +5,43 @@ const findDOMNode = require('react-dom').findDOMNode module.exports = EditableLabel - inherits(EditableLabel, Component) -function EditableLabel() { +function EditableLabel () { Component.call(this) } -EditableLabel.prototype.render = function() { +EditableLabel.prototype.render = function () { const props = this.props let state = this.state if (state && state.isEditingLabel) { - return h('div.editable-label', [ h('input.sizing-input', { defaultValue: props.textValue, - onKeyPress:(event) => { + onKeyPress: (event) => { this.saveIfEnter(event) }, }), h('button.editable-button', { - onClick:() => this.saveText(), - }, 'Save') + onClick: () => this.saveText(), + }, 'Save'), ]) - } else { return h('div.name-label', { - onClick:(event) => { + onClick: (event) => { this.setState({ isEditingLabel: true }) }, }, this.props.children) } } -EditableLabel.prototype.saveIfEnter = function(event) { +EditableLabel.prototype.saveIfEnter = function (event) { if (event.key === 'Enter') { this.saveText() } } -EditableLabel.prototype.saveText = function() { +EditableLabel.prototype.saveText = function () { var container = findDOMNode(this) var text = container.querySelector('.editable-label input').value this.props.saveText(text) |