Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion static/app/components/tours/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export interface TourElementProps<T extends TourEnumType>
children: React.ReactNode;
/**
* The description of the tour step.
* If null, a tooltip will not be displayed. This is useful if there are multiple
* elements you want to focus on in a single step.
*/
description: React.ReactNode;
/**
Expand All @@ -134,6 +136,8 @@ export interface TourElementProps<T extends TourEnumType>
id: TourStep<T>['id'];
/**
* The title of the tour step.
* If null, a tooltip will not be displayed. This is useful if there are multiple
* elements you want to focus on in a single step.
*/
title: React.ReactNode;
/**
Expand Down Expand Up @@ -310,7 +314,7 @@ export function TourGuide({
>
{children}
</Wrapper>
{isOpen
{isOpen && defined(title) && defined(description)
? createPortal(
<PositionWrapper zIndex={theme.zIndex.tour.overlay} {...overlayProps}>
<ClassNames>
Expand Down
54 changes: 54 additions & 0 deletions static/app/components/tours/tour.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,60 @@ export const MY_TOUR_KEY = 'tour.my_tour';
</TourProvider>
</Fragment>
));

story('Multiple highlighted elements', () => (
<Fragment>
<p>
Most of the time you'll want to highlight a single element. But if you need to
highlight multiple elements, you can do so by using the same step ID for each
element. Any that you do not want a tooltip for should pass null for the
title/description.
</p>
<TourProvider>
<TourElement<MyTour>
id={MyTour.NAME}
title={null}
description={null}
tourContext={MyTourContext}
>
<Input placeholder="Step 1: First Name" />
</TourElement>
<TourElement<MyTour>
id={MyTour.NAME}
title={'Name Time!'}
description={'Look at all these name inputs!'}
tourContext={MyTourContext}
position="right"
>
<Input placeholder="Step 1: Middle Name" />
</TourElement>
<TourElement<MyTour>
id={MyTour.NAME}
title={null}
description={null}
tourContext={MyTourContext}
>
<Input placeholder="Step 1: Last Name" />
</TourElement>
<TourElement<MyTour>
id={MyTour.EMAIL}
title={'Email Time!'}
description={'This is the description of the email tour step.'}
tourContext={MyTourContext}
>
<Input placeholder="Step 2: Email" type="email" />
</TourElement>
<TourElement<MyTour>
id={MyTour.PASSWORD}
title={'Password Time!'}
description={'This is the description of the password tour step.'}
tourContext={MyTourContext}
>
<Input placeholder="Step 3: Password" type="password" />
</TourElement>
</TourProvider>
</Fragment>
));
});

function StartTourButton() {
Expand Down
Loading