1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

[NewUI] Set default new account name as placeholder, but not value (#3121)

* Set default new account name as placehold, and not value, in new account create screen.

* Set new account number in create-form.js in constructor.
This commit is contained in:
Dan J Miller 2018-01-31 18:10:14 -03:30 committed by Alexander Tseung
parent 100642c0ea
commit 8378445112

View File

@ -7,16 +7,19 @@ const actions = require('../../actions')
class NewAccountCreateForm extends Component { class NewAccountCreateForm extends Component {
constructor (props) { constructor (props) {
super(props) super(props)
const { numberOfExistingAccounts = 0 } = props const { numberOfExistingAccounts = 0 } = props
const newAccountNumber = numberOfExistingAccounts + 1 const newAccountNumber = numberOfExistingAccounts + 1
this.state = { this.state = {
newAccountName: `Account ${newAccountNumber}`, newAccountName: '',
defaultAccountName: `Account ${newAccountNumber}`,
} }
} }
render () { render () {
const { newAccountName } = this.state const { newAccountName, defaultAccountName } = this.state
return h('div.new-account-create-form', [ return h('div.new-account-create-form', [
@ -26,8 +29,8 @@ class NewAccountCreateForm extends Component {
h('div.new-account-create-form__input-wrapper', {}, [ h('div.new-account-create-form__input-wrapper', {}, [
h('input.new-account-create-form__input', { h('input.new-account-create-form__input', {
value: this.state.newAccountName, value: newAccountName,
placeholder: 'E.g. My new account', placeholder: defaultAccountName,
onChange: event => this.setState({ newAccountName: event.target.value }), onChange: event => this.setState({ newAccountName: event.target.value }),
}, []), }, []),
]), ]),
@ -41,7 +44,7 @@ class NewAccountCreateForm extends Component {
]), ]),
h('button.new-account-create-form__button-create', { h('button.new-account-create-form__button-create', {
onClick: () => this.props.createAccount(newAccountName), onClick: () => this.props.createAccount(newAccountName || defaultAccountName),
}, [ }, [
'CREATE', 'CREATE',
]), ]),