Cleanup selector (#5971)
This commit is contained in:
parent
15d4bc9d6d
commit
7f77e6004c
@ -18,7 +18,7 @@ import { observer } from 'mobx-react';
|
|||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import { Button, Form, Input, IdentityIcon, Loading, RadioButtons } from '@parity/ui';
|
import { Button, Form, Input, IdentityIcon, Loading } from '@parity/ui';
|
||||||
import PasswordStrength from '@parity/ui/Form/PasswordStrength';
|
import PasswordStrength from '@parity/ui/Form/PasswordStrength';
|
||||||
import { RefreshIcon } from '@parity/ui/Icons';
|
import { RefreshIcon } from '@parity/ui/Icons';
|
||||||
|
|
||||||
@ -127,39 +127,13 @@ export default class CreateAccount extends Component {
|
|||||||
createStore={ this.props.createStore }
|
createStore={ this.props.createStore }
|
||||||
vaultStore={ this.props.vaultStore }
|
vaultStore={ this.props.vaultStore }
|
||||||
/>
|
/>
|
||||||
{ this.renderIdentitySelector() }
|
|
||||||
{ this.renderIdentities() }
|
{ this.renderIdentities() }
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderIdentitySelector () {
|
|
||||||
const { accounts, selectedAddress } = this.state;
|
|
||||||
|
|
||||||
if (!accounts) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<RadioButtons
|
|
||||||
className={ styles.selector }
|
|
||||||
name='identitySelector'
|
|
||||||
onChange={ this.onChangeIdentity }
|
|
||||||
value={ selectedAddress }
|
|
||||||
values={
|
|
||||||
Object.keys(accounts).map((address) => {
|
|
||||||
return {
|
|
||||||
key: address,
|
|
||||||
label: address
|
|
||||||
};
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderIdentities () {
|
renderIdentities () {
|
||||||
const { accounts } = this.state;
|
const { accounts, selectedAddress } = this.state;
|
||||||
|
|
||||||
if (!accounts) {
|
if (!accounts) {
|
||||||
return (
|
return (
|
||||||
@ -173,11 +147,20 @@ export default class CreateAccount extends Component {
|
|||||||
Object
|
Object
|
||||||
.keys(accounts)
|
.keys(accounts)
|
||||||
.map((address) => {
|
.map((address) => {
|
||||||
|
const _onSelect = (event) => this.onChangeIdentity(event, address);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={ styles.identity }
|
className={
|
||||||
|
[
|
||||||
|
styles.identity,
|
||||||
|
selectedAddress === address
|
||||||
|
? styles.selected
|
||||||
|
: styles.unselected
|
||||||
|
].join(' ')
|
||||||
|
}
|
||||||
key={ address }
|
key={ address }
|
||||||
onTouchTap={ this.onChangeIdentity }
|
onTouchTap={ _onSelect }
|
||||||
>
|
>
|
||||||
<IdentityIcon
|
<IdentityIcon
|
||||||
address={ address }
|
address={ address }
|
||||||
|
@ -79,21 +79,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.identities,
|
.identities {
|
||||||
.selector>div {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
|
||||||
|
|
||||||
.selector>div {
|
.identity {
|
||||||
margin-top: 1.5em;
|
border: 1px solid transparent;
|
||||||
}
|
cursor: pointer;
|
||||||
|
flex: 0 1 12.5%;
|
||||||
|
padding: 0.75em 0;
|
||||||
|
text-align: center;
|
||||||
|
width: 12.5% !important;
|
||||||
|
|
||||||
.identities .identity,
|
&.selected {
|
||||||
.selector>div>div {
|
border-color: #2185D0;
|
||||||
flex: 0 1 12.5%;
|
border-radius: 8px;
|
||||||
width: 12.5% !important;
|
background: rgba(200, 200, 225, 0.5);
|
||||||
text-align: center;
|
}
|
||||||
cursor: pointer;
|
|
||||||
|
&.unselected {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.refresh {
|
.refresh {
|
||||||
|
Loading…
Reference in New Issue
Block a user