-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHome.tsx
261 lines (256 loc) · 8.47 KB
/
Home.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
import React from 'react';
import { ReactGrandTourStep } from 'react-grand-tour';
import { Box } from '@material-ui/core';
import { GitHubBtn } from '../components';
export const HomeStepIds = {
customOne: 'home-one-custom',
one: 'home-one',
two: 'home-two',
three: 'home-three',
four: 'home-four',
fourContainer: 'home-four-container',
expandCollapseContainer: 'home-expand-collapse-container',
verticalOne: 'home-vertical-one',
horizontalOne: 'home-horizontal-one',
horVertOne: 'home-hotvert-one',
expandCollapseContainerTwo: 'home-expand-collapse-container-two',
verticalTwo: 'home-vertical-two',
horizontalTwo: 'home-horizontal-two',
horVertTwo: 'home-hotvert-two',
prefRight: 'preferRight',
prefLeft: 'preferLeft',
prefTop: 'preferTop',
bye: 'home-bye',
};
const Bye: React.FC = () => (
<Box p={2}>
<Box mb={1}>And that's it. I hope you liked the tour.</Box>
<Box mb={1}>
If you have any suggestions or find any bugs please do open an issue on GitHub.
</Box>
<Box mb={1}>While you're at it, drop me a star.</Box>
<Box textAlign="center">
<GitHubBtn />
</Box>
</Box>
);
// test
// const Hello: React.FC = () => (
// <Box p={2}>
// <Box mb={1}>The React Grand Tour modal is full customisable.</Box>
// <Box mb={1}>
// You can supply component overrides to the <CodeBlock>{'<ReactGrandTour/>'}</CodeBlock>
// </Box>
// <Box mb={1}>
// Like this:{' '}
// <Box>
// <CodeBlock multiLine>
// {`<ReactGrandTour
// closeButton={CloseBtn}
// />
// `}
// </CodeBlock>
// </Box>
// </Box>
// </Box>
// );
export const HomeSteps: ReactGrandTourStep[] = [
// {
// selector: `#${HomeStepIds.one}`,
// content: 'Welcome to React Grand Tour!',
// component: Hello,
// },
{
selector: `#${HomeStepIds.one}`,
content: 'Welcome to React Grand Tour!',
preferredModalPosition: 'bottom',
},
{
selector: `#${HomeStepIds.two}`,
content:
"And this is a cool logo. Try scrolling down the page. You'll see an arrow appear. You can click anywhere in this modal to be taken back to the highlighted area.",
},
{
selector: `#${HomeStepIds.three}`,
content: 'The highlighted area will track moving objects',
track: true,
preferredModalPosition: 'right',
},
{
selector: `#${HomeStepIds.four}`,
anchorSelector: `#${HomeStepIds.fourContainer}`,
content:
'The highlighted area will track moving objects, but the modal stays anchored to its container.',
track: true,
},
{
selector: `#${HomeStepIds.verticalOne}`,
content: 'The highlighted area will track the size of objects which change shape.',
track: true,
},
{
selector: `#${HomeStepIds.horizontalOne}`,
content:
"The highlighted area will track the size of objects which change shape. Even when it's their width!",
track: true,
},
{
selector: `#${HomeStepIds.horVertOne}`,
content: 'And when they change in both directions.',
track: true,
},
{
selector: `#${HomeStepIds.verticalTwo}`,
anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`,
content: 'The highlighted area will track the size of objects which change shape.',
track: true,
},
{
selector: `#${HomeStepIds.horizontalTwo}`,
anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`,
content:
"The highlighted area will track the size of objects which change shape. Even when it's their width!",
track: true,
},
{
selector: `#${HomeStepIds.horVertTwo}`,
anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`,
content: 'And when they change in both directions.',
track: true,
},
{
selector: `#row-1-col-1`,
content: 'I can even handle really wide scrolling content.',
},
{
selector: `#row-4-col-20`,
content: 'Just like that 😏',
},
{
selector: `#row-1-col-1`,
content: 'And that 😱',
},
{
selector: `#${HomeStepIds.prefRight}`,
content: 'I prefer to position this modal on the right',
preferredModalPosition: 'right',
},
{
selector: `#${HomeStepIds.prefLeft}`,
content: "I prefer to position this modal on the left, but there isn't enough space 😞",
preferredModalPosition: 'left',
},
{
selector: `#${HomeStepIds.prefTop}`,
content: 'I prefer to position this modal on top',
preferredModalPosition: 'top',
},
{
selector: `#${HomeStepIds.bye}`,
content: '',
component: Bye,
},
];
export const HiddenComponentsTour: ReactGrandTourStep[] = [
// {
// selector: `#${HomeStepIds.one}`,
// content: 'Welcome to React Grand Tour!',
// component: Hello,
// },
{
selector: `#middle`,
content:
"Welcome to React Grand Tour! I'm hiding the current step label on this step. This is an example of how to show the backdrop instead of focusing on an element.",
preferredModalPosition: 'auto',
hideStepElementHighlight: true,
},
{
selector: `#${HomeStepIds.two}`,
content:
"And this is a cool logo. Try scrolling down the page. You'll see an arrow appear. You can click anywhere in this modal to be taken back to the highlighted area.\n\n I'm hiding the next & previous step buttons, but you can still use the arrow keys.",
hideNextStepButton: true,
hidePreviousStepButton: true,
},
{
selector: `#${HomeStepIds.three}`,
content:
"The highlighted area will track moving objects. I'm hiding the step buttons here for fun",
track: true,
preferredModalPosition: 'right',
hideStepButtons: true,
},
{
selector: `#${HomeStepIds.four}`,
anchorSelector: `#${HomeStepIds.fourContainer}`,
content:
'The highlighted area will track moving objects, but the modal stays anchored to its container.',
track: true,
},
{
selector: `#${HomeStepIds.verticalOne}`,
content: 'The highlighted area will track the size of objects which change shape.',
track: true,
},
{
selector: `#${HomeStepIds.horizontalOne}`,
content:
"The highlighted area will track the size of objects which change shape. Even when it's their width!",
track: true,
},
{
selector: `#${HomeStepIds.horVertOne}`,
content: 'And when they change in both directions.',
track: true,
},
{
selector: `#${HomeStepIds.verticalTwo}`,
anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`,
content: 'The highlighted area will track the size of objects which change shape.',
track: true,
},
{
selector: `#${HomeStepIds.horizontalTwo}`,
anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`,
content:
"The highlighted area will track the size of objects which change shape. Even when it's their width!",
track: true,
},
{
selector: `#${HomeStepIds.horVertTwo}`,
anchorSelector: `#${HomeStepIds.expandCollapseContainerTwo}`,
content: 'And when they change in both directions.',
track: true,
},
{
selector: `#row-1-col-1`,
content: 'I can even handle really wide scrolling content.',
},
{
selector: `#row-4-col-20`,
content: 'Just like that 😏',
},
{
selector: `#row-1-col-1`,
content: 'And that 😱',
},
{
selector: `#${HomeStepIds.prefRight}`,
content: 'I prefer to position this modal on the right',
preferredModalPosition: 'right',
},
{
selector: `#${HomeStepIds.prefLeft}`,
content: "I prefer to position this modal on the left, but there isn't enough space 😞",
preferredModalPosition: 'left',
},
{
selector: `#${HomeStepIds.prefTop}`,
content: 'I prefer to position this modal on top',
preferredModalPosition: 'top',
},
{
selector: `#${HomeStepIds.bye}`,
content: '',
component: Bye,
},
];