aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/onboarding/onboarding_flow.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website/ts/components/onboarding/onboarding_flow.tsx')
-rw-r--r--packages/website/ts/components/onboarding/onboarding_flow.tsx28
1 files changed, 20 insertions, 8 deletions
diff --git a/packages/website/ts/components/onboarding/onboarding_flow.tsx b/packages/website/ts/components/onboarding/onboarding_flow.tsx
index c2b4a4ca7..91d5f2476 100644
--- a/packages/website/ts/components/onboarding/onboarding_flow.tsx
+++ b/packages/website/ts/components/onboarding/onboarding_flow.tsx
@@ -2,11 +2,14 @@ import * as React from 'react';
import { Placement, Popper, PopperChildrenProps } from 'react-popper';
import { OnboardingCard } from 'ts/components/onboarding/onboarding_card';
-import { ContinueButtonDisplay, OnboardingTooltip } from 'ts/components/onboarding/onboarding_tooltip';
+import {
+ ContinueButtonDisplay,
+ OnboardingTooltip,
+ TooltipPointerDisplay,
+} from 'ts/components/onboarding/onboarding_tooltip';
import { Animation } from 'ts/components/ui/animation';
import { Container } from 'ts/components/ui/container';
import { Overlay } from 'ts/components/ui/overlay';
-import { PointerDirection } from 'ts/components/ui/pointer';
import { zIndex } from 'ts/style/z_index';
export interface FixedPositionSettings {
@@ -15,7 +18,7 @@ export interface FixedPositionSettings {
bottom?: string;
left?: string;
right?: string;
- pointerDirection?: PointerDirection;
+ tooltipPointerDisplay?: TooltipPointerDisplay;
}
export interface TargetPositionSettings {
@@ -28,12 +31,15 @@ export interface Step {
// Provide either a CSS selector, or fixed position settings. Only applies to desktop.
position: TargetPositionSettings | FixedPositionSettings;
title?: string;
+ shouldCenterTitle?: boolean;
content: React.ReactNode;
shouldHideBackButton?: boolean;
shouldHideNextButton?: boolean;
continueButtonDisplay?: ContinueButtonDisplay;
continueButtonText?: string;
onContinueButtonClick?: () => void;
+ // Only used for very custom steps.
+ shouldRemoveExtraSpacing?: boolean;
}
export interface OnboardingFlowProps {
@@ -44,12 +50,14 @@ export interface OnboardingFlowProps {
updateOnboardingStep: (stepIndex: number) => void;
disableOverlay?: boolean;
isMobile: boolean;
+ disableCloseOnClickOutside?: boolean;
}
export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
public static defaultProps = {
disableOverlay: false,
isMobile: false,
+ disableCloseOnClickOutside: false,
};
public render(): React.ReactNode {
if (!this.props.isRunning) {
@@ -67,7 +75,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
</Popper>
);
} else if (currentStep.position.type === 'fixed') {
- const { top, right, bottom, left, pointerDirection } = currentStep.position;
+ const { top, right, bottom, left, tooltipPointerDisplay } = currentStep.position;
onboardingElement = (
<Container
position="fixed"
@@ -77,7 +85,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
bottom={bottom}
left={left}
>
- {this._renderToolTip(pointerDirection)}
+ {this._renderToolTip(tooltipPointerDisplay)}
</Container>
);
}
@@ -86,7 +94,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
}
return (
<div>
- <Overlay onClick={this.props.onClose} />
+ <Overlay onClick={this.props.disableCloseOnClickOutside ? undefined : this.props.onClose} />
{onboardingElement}
</div>
);
@@ -101,7 +109,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
</div>
);
}
- private _renderToolTip(pointerDirection?: PointerDirection): React.ReactNode {
+ private _renderToolTip(tooltipPointerDisplay?: TooltipPointerDisplay): React.ReactNode {
const { steps, stepIndex } = this.props;
const step = steps[stepIndex];
const isLastStep = steps.length - 1 === stepIndex;
@@ -109,6 +117,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
<Container marginLeft="30px" width="400px">
<OnboardingTooltip
title={step.title}
+ shouldCenterTitle={step.shouldCenterTitle}
content={step.content}
isLastStep={isLastStep}
shouldHideBackButton={step.shouldHideBackButton}
@@ -119,7 +128,8 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
continueButtonDisplay={step.continueButtonDisplay}
continueButtonText={step.continueButtonText}
onContinueButtonClick={step.onContinueButtonClick}
- pointerDirection={pointerDirection}
+ pointerDisplay={tooltipPointerDisplay}
+ shouldRemoveExtraSpacing={step.shouldRemoveExtraSpacing}
/>
</Container>
);
@@ -133,6 +143,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
<Container position="relative" zIndex={1}>
<OnboardingCard
title={step.title}
+ shouldCenterTitle={step.shouldCenterTitle}
content={step.content}
isLastStep={isLastStep}
shouldHideBackButton={step.shouldHideBackButton}
@@ -144,6 +155,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
continueButtonText={step.continueButtonText}
onContinueButtonClick={step.onContinueButtonClick}
borderRadius="10px 10px 0px 0px"
+ shouldRemoveExtraSpacing={step.shouldRemoveExtraSpacing}
/>
</Container>
);