Misc. small UI fixes (#4657)

* Shorten menu items (accounts)

* Shorten menu items (addresses)

* Shorten menu items (contracts)

* Shorten menu items (account)

* Shorten menu items (address)

* Shorten menu items (contract)

* Auto-focus & perform default action

* Auto-focus & default action

* Auto focus for first fields (create account)

* Clear phrase & auto-focus field

* Auto-focus name fields

* Add autoFocus (Add Address)

* autoFocus address (Add Contract)

* Auto focus name field

* Auto-focus name field for EditMeta

* Auto-focus modifications (WalletSettings)

* Verification auto focus

* typo

* Double-up on keys
This commit is contained in:
Jaco Greeff
2017-02-24 12:26:30 +01:00
committed by GitHub
parent f97e775498
commit 0b214450e3
24 changed files with 116 additions and 80 deletions

View File

@@ -68,6 +68,7 @@ export default class Input extends Component {
onBlur: PropTypes.func,
onChange: PropTypes.func,
onClick: PropTypes.func,
onDefaultAction: PropTypes.func,
onFocus: PropTypes.func,
onKeyDown: PropTypes.func,
onSubmit: PropTypes.func,
@@ -230,7 +231,7 @@ export default class Input extends Component {
const { value } = event.target;
if (event.which === 13) {
this.onSubmit(value);
this.onSubmit(value, true);
} else if (event.which === 27) {
// TODO ESC, revert to original
}
@@ -238,9 +239,17 @@ export default class Input extends Component {
this.props.onKeyDown && this.props.onKeyDown(event);
}
onSubmit = (value) => {
onSubmit = (value, performDefault) => {
const { onDefaultAction, onSubmit } = this.props;
this.setValue(value, () => {
this.props.onSubmit && this.props.onSubmit(value);
if (onSubmit) {
onSubmit(value);
}
if (performDefault && onDefaultAction) {
onDefaultAction();
}
});
}

View File

@@ -30,6 +30,7 @@ class InputAddress extends Component {
static propTypes = {
accountsInfo: PropTypes.object,
allowCopy: PropTypes.bool,
autoFocus: PropTypes.bool,
className: PropTypes.string,
disabled: PropTypes.bool,
error: PropTypes.string,
@@ -56,7 +57,7 @@ class InputAddress extends Component {
};
render () {
const { accountsInfo, allowCopy, className, disabled, error, focused, hint } = this.props;
const { accountsInfo, allowCopy, autoFocus, className, disabled, error, focused, hint } = this.props;
const { hideUnderline, label, onClick, onFocus, readOnly, small } = this.props;
const { tabIndex, text, tokens, value } = this.props;
const account = value && (accountsInfo[value] || tokens[value]);
@@ -85,6 +86,7 @@ class InputAddress extends Component {
<div className={ containerClasses.join(' ') }>
<Input
allowCopy={ allowCopy && ((disabled || readOnly) ? value : false) }
autoFocus={ autoFocus }
className={ classes.join(' ') }
disabled={ disabled }
error={ error }