Skip to content

Commit

Permalink
Add a clear, obvious way to remove hotkeys to improve UX (#2867)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbrcz committed Nov 28, 2017
1 parent 23a4bb8 commit e831ec1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/renderer/ui/components/settings/HotkeyInput.js
Expand Up @@ -10,6 +10,16 @@ const styles = {
width: '50%',
float: 'left',
padding: '4px 6px',
position: 'relative',
},
clearButton: {
'background-color': 'Transparent',
border: 'none',
outline: 'none',
cursor: 'pointer',
position: 'absolute',
right: 10,
top: 45,
},
};

Expand Down Expand Up @@ -106,17 +116,23 @@ class HotkeyInput extends Component {
}

render() {
let clearButton;
const hotkeyAction = this.props.hotkeys[this.props.hotkeyAction];
if (hotkeyAction) {
clearButton = <button type="button" style={styles.clearButton} onClick={this._reset}></button>;
}
return (
<div style={styles.inputContainer}>
<TextField
hintText={TranslationProvider.query('settings-option-hotkey-hint')}
floatingLabelText={this.props.label}
floatingLabelFixed
value={this.props.hotkeys[this.props.hotkeyAction] || TranslationProvider.query('settings-option-hotkey-not-set')}
value={hotkeyAction || TranslationProvider.query('settings-option-hotkey-not-set')}
onKeyDown={this._handleKeyDown}
onKeyUp={this._handleKeyUp}
fullWidth
/>
{clearButton}
</div>
);
}
Expand Down

0 comments on commit e831ec1

Please sign in to comment.