Skip to content

Commit

Permalink
Add button to force edit token symbol when adding custom token (#6147)
Browse files Browse the repository at this point in the history
  • Loading branch information
chikeichan authored and whymarrh committed Feb 13, 2019
1 parent c54656e commit d438dee
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
20 changes: 18 additions & 2 deletions ui/app/components/pages/add-token/add-token.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class AddToken extends Component {
customDecimalsError: null,
autoFilled: false,
displayedTab: SEARCH_TAB,
forceEditSymbol: false,
}
}

Expand Down Expand Up @@ -225,6 +226,7 @@ class AddToken extends Component {
customSymbolError,
customDecimalsError,
autoFilled,
forceEditSymbol,
} = this.state

return (
Expand All @@ -241,14 +243,28 @@ class AddToken extends Component {
/>
<TextField
id="custom-symbol"
label={this.context.t('tokenSymbol')}
label={(
<div className="add-token__custom-symbol__label-wrapper">
<span className="add-token__custom-symbol__label">
{this.context.t('tokenSymbol')}
</span>
{(autoFilled && !forceEditSymbol) && (
<div
className="add-token__custom-symbol__edit"
onClick={() => this.setState({ forceEditSymbol: true })}
>
{this.context.t('edit')}
</div>
)}
</div>
)}
type="text"
value={customSymbol}
onChange={e => this.handleCustomSymbolChange(e.target.value)}
error={customSymbolError}
fullWidth
margin="normal"
disabled={autoFilled}
disabled={autoFilled && !forceEditSymbol}
/>
<TextField
id="custom-decimals"
Expand Down
20 changes: 20 additions & 0 deletions ui/app/components/pages/add-token/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,24 @@
&__token-list {
margin-top: 16px;
}

&__custom-symbol {

&__label-wrapper {
display: flex;
flex-flow: row nowrap;
}

&__label {
flex: 0 0 auto;
}

&__edit {
flex: 1 1 auto;
text-align: right;
color: $curious-blue;
padding-right: 4px;
cursor: pointer;
}
}
}

0 comments on commit d438dee

Please sign in to comment.