Gaëtan Renaudeau
7 years ago
5 changed files with 42 additions and 9 deletions
@ -0,0 +1,28 @@ |
|||
// @flow
|
|||
|
|||
import React, { PureComponent } from 'react' |
|||
import { connect } from 'react-redux' |
|||
import { createStructuredSelector } from 'reselect' |
|||
import { hasCompletedOnboardingSelector } from 'reducers/settings' |
|||
import Onboarding from './Onboarding' |
|||
|
|||
type Props = { |
|||
hasCompletedOnboarding: boolean, |
|||
children: *, |
|||
} |
|||
|
|||
class OnboardingOrElse extends PureComponent<Props> { |
|||
render() { |
|||
const { hasCompletedOnboarding, children } = this.props |
|||
if (hasCompletedOnboarding) { |
|||
return children |
|||
} |
|||
return <Onboarding /> |
|||
} |
|||
} |
|||
|
|||
export default connect( |
|||
createStructuredSelector({ |
|||
hasCompletedOnboarding: hasCompletedOnboardingSelector, |
|||
}), |
|||
)(OnboardingOrElse) |
Loading…
Reference in new issue