From f8f8bd95ca8ef94b583766d3d8c9d9ac71f04938 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 24 May 2018 11:24:10 -0700 Subject: Improve OnboardingFlow API and typescript types --- packages/website/ts/components/onboarding/onboarding_flow.tsx | 6 +++--- .../website/ts/components/onboarding/portal_onboarding_flow.tsx | 8 ++------ packages/website/ts/containers/portal_onboarding_flow.ts | 6 +++--- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'packages/website/ts') diff --git a/packages/website/ts/components/onboarding/onboarding_flow.tsx b/packages/website/ts/components/onboarding/onboarding_flow.tsx index dd417856f..621d14260 100644 --- a/packages/website/ts/components/onboarding/onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/onboarding_flow.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; import * as React from 'react'; -import Joyride, { Step, StyleOptions } from 'react-joyride'; +import Joyride, { CallbackData, Step, StyleOptions } from 'react-joyride'; import { zIndex } from 'ts/utils/style'; @@ -30,8 +30,8 @@ export class OnboardingFlow extends React.Component { ); } - private _handleChange(options: any): void { - switch (options.action) { + private _handleChange(data: CallbackData): void { + switch (data.action) { case 'close': this.props.onClose(); } diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index 9bccd0a9c..11684aaee 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -6,7 +6,7 @@ import { OnboardingFlow } from 'ts/components/onboarding/onboarding_flow'; export interface PortalOnboardingFlowProps { stepIndex: number; isRunning: boolean; - setOnboardingShowing: (isShowing: boolean) => void; + onClose: () => void; } const steps: Step[] = [ @@ -25,12 +25,8 @@ export class PortalOnboardingFlow extends React.Component ); } - - private _handleClose(): void { - this.props.setOnboardingShowing(false); - } } diff --git a/packages/website/ts/containers/portal_onboarding_flow.ts b/packages/website/ts/containers/portal_onboarding_flow.ts index e62e46dd1..3cd4e8510 100644 --- a/packages/website/ts/containers/portal_onboarding_flow.ts +++ b/packages/website/ts/containers/portal_onboarding_flow.ts @@ -14,7 +14,7 @@ interface ConnectedState { } interface ConnectedDispatch { - setOnboardingShowing: (isShowing: boolean) => void; + onClose: () => void; } const mapStateToProps = (state: State): ConnectedState => ({ @@ -23,10 +23,10 @@ const mapStateToProps = (state: State): ConnectedState => ({ }); const mapDispatchToProps = (dispatch: Dispatch): ConnectedDispatch => ({ - setOnboardingShowing: (isShowing: boolean): void => { + onClose: (): void => { dispatch({ type: ActionTypes.UpdatePortalOnboardingShowing, - data: isShowing, + data: false, }); }, }); -- cgit v1.2.3