Add buttons examples
Browse files- docs/package.json +1 -1
- docs/pnpm-lock.yaml +4 -4
- docs/src/components/CodeSample.tsx +22 -0
- docs/src/content/guides/buttons.mdx +5 -15
docs/package.json
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
"@types/react": "^18.0.21",
|
17 |
"@types/react-dom": "^18.0.6",
|
18 |
"astro": "^2.7.0",
|
19 |
-
"driver.js": "1.1.
|
20 |
"react": "^18.0.0",
|
21 |
"react-dom": "^18.0.0",
|
22 |
"react-fast-marquee": "^1.6.0",
|
|
|
16 |
"@types/react": "^18.0.21",
|
17 |
"@types/react-dom": "^18.0.6",
|
18 |
"astro": "^2.7.0",
|
19 |
+
"driver.js": "1.1.10-next.0",
|
20 |
"react": "^18.0.0",
|
21 |
"react-dom": "^18.0.0",
|
22 |
"react-fast-marquee": "^1.6.0",
|
docs/pnpm-lock.yaml
CHANGED
@@ -24,8 +24,8 @@ dependencies:
|
|
24 |
specifier: ^2.7.0
|
25 |
version: 2.7.0
|
26 |
driver.js:
|
27 |
-
specifier: 1.1.
|
28 |
-
version: 1.1.
|
29 |
react:
|
30 |
specifier: ^18.0.0
|
31 |
version: 18.0.0
|
@@ -1386,8 +1386,8 @@ packages:
|
|
1386 | |
1387 |
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
|
1388 |
|
1389 |
-
/[email protected].
|
1390 |
-
resolution: {integrity: sha512-
|
1391 |
dev: false
|
1392 |
|
1393 |
|
|
24 |
specifier: ^2.7.0
|
25 |
version: 2.7.0
|
26 |
driver.js:
|
27 |
+
specifier: 1.1.10-next.0
|
28 |
+
version: 1.1.10-next.0
|
29 |
react:
|
30 |
specifier: ^18.0.0
|
31 |
version: 18.0.0
|
|
|
1386 | |
1387 |
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
|
1388 |
|
1389 |
+
/[email protected].10-next.0:
|
1390 |
+
resolution: {integrity: sha512-ohPvCv3l9Sv/RfePefnOd90W3a0TRi/Z4GsgwO3eyHI9/BQRxHWpzmpGfG9yh16re9T6Lb2V4qQ4vPnn72gV9g==}
|
1391 |
dev: false
|
1392 |
|
1393 |
docs/src/components/CodeSample.tsx
CHANGED
@@ -61,6 +61,28 @@ export function CodeSample(props: CodeSampleProps) {
|
|
61 |
};
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
if (tour?.[2]?.popover?.title === "Next Step is Async") {
|
65 |
tour[2].popover.onNextClick = () => {
|
66 |
mountDummyElement();
|
|
|
61 |
};
|
62 |
}
|
63 |
|
64 |
+
if (id === "logger-events") {
|
65 |
+
config!.onNextClick = () => {
|
66 |
+
console.log("next clicked");
|
67 |
+
};
|
68 |
+
|
69 |
+
config!.onNextClick = () => {
|
70 |
+
console.log("Next Button Clicked");
|
71 |
+
// Implement your own functionality here
|
72 |
+
driverObj.moveNext();
|
73 |
+
};
|
74 |
+
config!.onPrevClick = () => {
|
75 |
+
console.log("Previous Button Clicked");
|
76 |
+
// Implement your own functionality here
|
77 |
+
driverObj.movePrevious();
|
78 |
+
};
|
79 |
+
config!.onCloseClick = () => {
|
80 |
+
console.log("Close Button Clicked");
|
81 |
+
// Implement your own functionality here
|
82 |
+
driverObj.destroy();
|
83 |
+
};
|
84 |
+
}
|
85 |
+
|
86 |
if (tour?.[2]?.popover?.title === "Next Step is Async") {
|
87 |
tour[2].popover.onNextClick = () => {
|
88 |
mountDummyElement();
|
docs/src/content/guides/buttons.mdx
CHANGED
@@ -185,23 +185,13 @@ You can use the `onNextClick`, `onPreviousClick` and `onCloseClick` callbacks to
|
|
185 |
|
186 |
<CodeSample
|
187 |
buttonText={"Show Example"}
|
188 |
-
config={{
|
189 |
-
onNextClick: () => {
|
190 |
-
alert('Next Button Clicked');
|
191 |
-
},
|
192 |
-
onPrevClick:() => {
|
193 |
-
alert('Previous Button Clicked');
|
194 |
-
},
|
195 |
-
onCloseClick:() => {
|
196 |
-
alert('Close Button Clicked');
|
197 |
-
},
|
198 |
-
}}
|
199 |
tour={[
|
200 |
{
|
201 |
-
element: '#
|
202 |
popover: {
|
203 |
-
title: '
|
204 |
-
description: '
|
205 |
}
|
206 |
},
|
207 |
{
|
@@ -212,7 +202,7 @@ You can use the `onNextClick`, `onPreviousClick` and `onCloseClick` callbacks to
|
|
212 |
}
|
213 |
}
|
214 |
]}
|
215 |
-
id={"
|
216 |
client:load>
|
217 |
```js
|
218 |
import { driver } from "driver.js";
|
|
|
185 |
|
186 |
<CodeSample
|
187 |
buttonText={"Show Example"}
|
188 |
+
config={{}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
tour={[
|
190 |
{
|
191 |
+
element: '#logger-events',
|
192 |
popover: {
|
193 |
+
title: 'Events Logged',
|
194 |
+
description: 'Look at your console for the events logged'
|
195 |
}
|
196 |
},
|
197 |
{
|
|
|
202 |
}
|
203 |
}
|
204 |
]}
|
205 |
+
id={"logger-events"}
|
206 |
client:load>
|
207 |
```js
|
208 |
import { driver } from "driver.js";
|