sms verification: basic stepper

This commit is contained in:
Jannis R 2016-11-03 18:13:45 +01:00
parent f96e69309f
commit fc76fa9252
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5
2 changed files with 62 additions and 14 deletions

View File

@ -33,7 +33,6 @@ export default class SMSVerification extends Component {
} }
static propTypes = { static propTypes = {
isTest: PropTypes.bool,
account: PropTypes.string, account: PropTypes.string,
onClose: PropTypes.func.isRequired onClose: PropTypes.func.isRequired
} }
@ -54,36 +53,82 @@ export default class SMSVerification extends Component {
} }
render () { render () {
const { step } = this.state;
return ( return (
<Modal <Modal
actions={ this.renderDialogActions() } actions={ this.renderDialogActions() }
title='verify your account via SMS' title='verify your account via SMS'
waiting={ [4] }
visible scroll visible scroll
current={ step }
steps={ ['first step', 'second step'] }
> >
<span>foo</span> { this.renderStep() }
</Modal> </Modal>
); );
} }
renderDialogActions () { renderDialogActions () {
const { onClose, account } = this.props; const { onClose, account } = this.props;
const { step } = this.state;
return ( const cancel = (
<div>
<Button <Button
key='cancel' key='cancel' label='Cancel'
label='Cancel'
icon={ <ContentClear /> } icon={ <ContentClear /> }
onClick={ onClose } onClick={ onClose }
/> />
);
if (step === 1) {
return (
<div>
{ cancel }
<Button <Button
key='close' key='done' label='Done'
label='Done'
icon={ <ActionDoneAll /> } icon={ <ActionDoneAll /> }
onClick={ onClose } onClick={ onClose }
/> />
</div> </div>
); );
} }
return (
<div>
{ cancel }
<Button
key='next' label='Next'
icon={ <IdentityIcon address={ account } button /> }
onClick={ this.next }
/>
</div>
);
}
renderStep () {
const { step } = this.state;
if (step === 1) {
return this.renderSecondStep();
} else {
return this.renderFirstStep();
}
}
next = () => {
this.setState({
step: this.state.step + 1
});
}
renderFirstStep () {
return (
<span>first step</span>
);
}
renderSecondStep () {
return (
<span>second step</span>
);
}
} }

View File

@ -166,7 +166,10 @@ class Account extends Component {
// TODO: pass props // TODO: pass props
return ( return (
<SMSVerification onClose={ this.onVerificationClose } /> <SMSVerification
account={ address }
onClose={ this.onVerificationClose }
/>
); );
} }