Skip to content

Commit dd5ddd7

Browse files
refactor: lazy load modal tours
1 parent ff366d7 commit dd5ddd7

File tree

15 files changed

+651
-591
lines changed

15 files changed

+651
-591
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# How to create new tours
2+
3+
## 1. Create a unique tourID for the tour
4+
5+
Let's say the tourId is `design-library`
6+
7+
## 2. Add the GuidedModalTour component
8+
9+
Add the GuidedModalTour component to where we want to show the tour. This tour
10+
will be visible only once when the component is rendered.
11+
12+
For example in `design-library` tour, we can add it in the actual design library
13+
modal render:
14+
15+
```js
16+
<GuidedModalTour tourId="design-library" />
17+
```
18+
19+
## 3. Add initialization code to trigger the tour if needed
20+
21+
Since the `GuidedModalTour` component is only rendered when the tour is actually
22+
shown, if we are coming from the Getting Started screen, and we want to force
23+
the tour to open and need to perform any code for this, then we can add them in:
24+
25+
`src/plugins/guided-modal-tour/index.js`
26+
27+
## 4. Add the show condition for the tour
28+
29+
By default, `GuidedModalTour` only shows once. When it's finished, it will not
30+
show again. We can change this behavior e.g. stop the tour from showing, by
31+
adding a condition in `./tour-conditions.js`.
32+
33+
## 5. Create the tour steps
34+
35+
Create the tour steps in `src/lazy-components/modal-tour/tours/`, refer to
36+
`src/lazy-components/modal-tour/tours/README.md` for more details
37+

0 commit comments

Comments
 (0)