Add animated example
Browse files
docs/src/components/CodeSample.tsx
CHANGED
@@ -19,7 +19,9 @@ export function CodeSample(props: CodeSampleProps) {
|
|
19 |
|
20 |
function onClick() {
|
21 |
if (highlight) {
|
22 |
-
const driverObj = driver(
|
|
|
|
|
23 |
driverObj.highlight(highlight);
|
24 |
} else if (tour) {
|
25 |
const driverObj = driver({
|
|
|
19 |
|
20 |
function onClick() {
|
21 |
if (highlight) {
|
22 |
+
const driverObj = driver({
|
23 |
+
...config
|
24 |
+
});
|
25 |
driverObj.highlight(highlight);
|
26 |
} else if (tour) {
|
27 |
const driverObj = driver({
|
docs/src/content/guides/animated-tour.mdx
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: "Animated Tour"
|
3 |
+
groupTitle: "Examples"
|
4 |
+
sort: 2
|
5 |
+
---
|
6 |
+
|
7 |
+
import { CodeSample } from "../../components/CodeSample.tsx";
|
8 |
+
|
9 |
+
The following example shows how to create a simple tour with a few steps. Click the button below the code sample to see the tour in action.
|
10 |
+
|
11 |
+
<CodeSample
|
12 |
+
heading={'Basic Animated Tour'}
|
13 |
+
config={{
|
14 |
+
animate: true,
|
15 |
+
showButtons: ['next', 'previous'],
|
16 |
+
}}
|
17 |
+
tour={[
|
18 |
+
{ element: '#tour-example', popover: { title: 'Animated Tour Example', description: 'Here is the code example showing animated tour. Let\'s walk you through it.', side: "left", align: 'start' }},
|
19 |
+
{ element: '.line:nth-child(1)', popover: { title: 'Import the Library', description: 'It works the same in vanilla JavaScript as well as frameworks.', side: "bottom", align: 'start' }},
|
20 |
+
{ element: '.line:nth-child(2)', popover: { title: 'Importing CSS', description: 'Import the CSS which gives you the default styling for popover and overlay.', side: "bottom", align: 'start' }},
|
21 |
+
{ element: '.line:nth-child(4) span:nth-child(7)', popover: { title: 'Create Driver', description: 'Simply call the driver function to create a driver.js instance', side: "left", align: 'start' }},
|
22 |
+
{ element: '.line:nth-child(14)', popover: { title: 'Start Tour', description: 'Call the drive method to start the tour and your tour will be started.', side: "top", align: 'start' }},
|
23 |
+
{ element: 'a[href="/docs/configuration"]', popover: { title: 'More Configuration', description: 'Look at this page for all the configuration options you can pass.', side: "right", align: 'start' }},
|
24 |
+
{ popover: { title: 'Happy Coding', description: 'And that is all, go ahead and start adding tours to your applications.' } }
|
25 |
+
]}
|
26 |
+
id={"tour-example"}
|
27 |
+
client:load
|
28 |
+
>
|
29 |
+
```js
|
30 |
+
import { driver } from "driver.js";
|
31 |
+
import "driver.js/dist/driver.css";
|
32 |
+
|
33 |
+
const driverObj = driver({
|
34 |
+
showProgress: true,
|
35 |
+
steps: [
|
36 |
+
{ element: '#tour-example', popover: { title: 'Animated Tour Example', description: 'Here is the code example showing animated tour. Let\'s walk you through it.', side: "left", align: 'start' }},
|
37 |
+
{ element: 'code .line:nth-child(1)', popover: { title: 'Import the Library', description: 'It works the same in vanilla JavaScript as well as frameworks.', side: "bottom", align: 'start' }},
|
38 |
+
{ element: 'code .line:nth-child(2)', popover: { title: 'Importing CSS', description: 'Import the CSS which gives you the default styling for popover and overlay.', side: "bottom", align: 'start' }},
|
39 |
+
{ element: 'code .line:nth-child(4) span:nth-child(7)', popover: { title: 'Create Driver', description: 'Simply call the driver function to create a driver.js instance', side: "left", align: 'start' }},
|
40 |
+
{ element: 'code .line:nth-child(14)', popover: { title: 'Start Tour', description: 'Call the drive method to start the tour and your tour will be started.', side: "top", align: 'start' }},
|
41 |
+
{ element: 'a[href="/docs/configuration"]', popover: { title: 'More Configuration', description: 'Look at this page for all the configuration options you can pass.', side: "right", align: 'start' }},
|
42 |
+
{ popover: { title: 'Happy Coding', description: 'And that is all, go ahead and start adding tours to your applications.' } }
|
43 |
+
]
|
44 |
+
});
|
45 |
+
|
46 |
+
driver.drive();
|
47 |
+
```
|
48 |
+
</CodeSample>
|
docs/src/pages/index.astro
CHANGED
@@ -4,6 +4,9 @@ import { FeatureMarquee } from "../components/FeatureMarquee";
|
|
4 |
import Container from "../components/Container.astro";
|
5 |
import UsecaseItem from "../components/UsecaseItem.astro";
|
6 |
import { ExampleButton } from "../components/examples/ExampleButton";
|
|
|
|
|
|
|
7 |
---
|
8 |
<BaseLayout>
|
9 |
<div class="bg-yellow-300">
|
@@ -92,7 +95,7 @@ import { ExampleButton } from "../components/examples/ExampleButton";
|
|
92 |
<a href="https://github.com/kamranahmedse/driver.js"
|
93 |
target="_blank"
|
94 |
class="flex items-center font-bold text-2xl rounded-xl py-3 px-5 bg-yellow-300 border-black hover:bg-yellow-400">
|
95 |
-
<span class="mr-3 inline-flex items-center"><img src="/star.svg" alt="Hero Image" class="h-7 mr-2" />
|
96 |
GitHub Stars
|
97 |
</a>
|
98 |
<a href="/docs/installation"
|
|
|
4 |
import Container from "../components/Container.astro";
|
5 |
import UsecaseItem from "../components/UsecaseItem.astro";
|
6 |
import { ExampleButton } from "../components/examples/ExampleButton";
|
7 |
+
import { getFormattedStars } from "../lib/github";
|
8 |
+
|
9 |
+
const starCount = getFormattedStars('kamranahmedse/driver.js');
|
10 |
---
|
11 |
<BaseLayout>
|
12 |
<div class="bg-yellow-300">
|
|
|
95 |
<a href="https://github.com/kamranahmedse/driver.js"
|
96 |
target="_blank"
|
97 |
class="flex items-center font-bold text-2xl rounded-xl py-3 px-5 bg-yellow-300 border-black hover:bg-yellow-400">
|
98 |
+
<span class="mr-3 inline-flex items-center"><img src="/star.svg" alt="Hero Image" class="h-7 mr-2" /> { starCount }</span>
|
99 |
GitHub Stars
|
100 |
</a>
|
101 |
<a href="/docs/installation"
|