Browse Source

remove unnecessary compexity from footer definition in onboarding

master
Anastasia Poupeney 7 years ago
parent
commit
efeb16d987
  1. 13
      src/components/Onboarding/OnboardingFooter.js
  2. 15
      src/components/Onboarding/steps/SelectDevice.js

13
src/components/Onboarding/OnboardingFooter.js

@ -22,8 +22,6 @@ type Props = {
t: T,
nextStep: () => void,
prevStep: () => void,
jumpStep?: string => void,
jumpTo?: string,
isContinueDisabled?: boolean,
}
@ -32,21 +30,14 @@ const OnboardingFooter = ({
nextStep,
prevStep,
isContinueDisabled,
jumpStep,
jumpTo,
...props
}: Props) => (
<Wrapper {...props}>
<Button padded outlineGrey onClick={() => prevStep()}>
{t('common:back')}
</Button>
<Button
padded
disabled={isContinueDisabled}
primary
onClick={() => (jumpTo && jumpStep ? jumpStep(jumpTo) : nextStep())}
ml="auto"
>
<Button padded disabled={isContinueDisabled} primary onClick={() => nextStep()} ml="auto">
{t('common:continue')}
</Button>
</Wrapper>

15
src/components/Onboarding/steps/SelectDevice.js

@ -22,8 +22,17 @@ class SelectDevice extends PureComponent<StepProps, {}> {
handleIsLedgerNano = (isLedgerNano: boolean) => {
this.props.isLedgerNano(isLedgerNano)
}
handleContinue = () => {
const { nextStep, jumpStep, onboarding } = this.props
if (onboarding.flowType === 'initializedDevice') {
jumpStep('genuineCheck')
} else {
nextStep()
}
}
render() {
const { t, onboarding, nextStep, prevStep, jumpStep } = this.props
const { t, onboarding, prevStep } = this.props
return (
<Box sticky>
<Box grow alignItems="center" justifyContent="center">
@ -59,11 +68,9 @@ class SelectDevice extends PureComponent<StepProps, {}> {
horizontal
flow={2}
t={t}
nextStep={nextStep}
nextStep={this.handleContinue}
prevStep={prevStep}
jumpStep={jumpStep}
isContinueDisabled={onboarding.isLedgerNano === null}
jumpTo={onboarding.flowType === 'initializedDevice' ? 'genuineCheck' : undefined}
/>
</Box>
)

Loading…
Cancel
Save