kamrify commited on
Commit
43f2c65
·
1 Parent(s): 61b1b0a

Add animated and static examples

Browse files
docs/package.json CHANGED
@@ -20,7 +20,7 @@
20
  "react": "^18.2.0",
21
  "react-dom": "^18.2.0",
22
  "react-fast-marquee": "^1.6.0",
23
- "tailwindcss": "^3.3.2"
24
  },
25
  "devDependencies": {
26
  "@tailwindcss/typography": "^0.5.9"
 
20
  "react": "^18.2.0",
21
  "react-dom": "^18.2.0",
22
  "react-fast-marquee": "^1.6.0",
23
+ "tailwindcss": "^3.0.24"
24
  },
25
  "devDependencies": {
26
  "@tailwindcss/typography": "^0.5.9"
docs/pnpm-lock.yaml CHANGED
@@ -36,7 +36,7 @@ dependencies:
36
  specifier: ^1.6.0
37
38
  tailwindcss:
39
- specifier: ^3.3.2
40
  version: 3.3.2
41
 
42
  devDependencies:
 
36
  specifier: ^1.6.0
37
38
  tailwindcss:
39
+ specifier: ^3.0.24
40
  version: 3.3.2
41
 
42
  devDependencies:
docs/src/content/guides/animated-tour.mdx CHANGED
@@ -12,6 +12,7 @@ The following example shows how to create a simple tour with a few steps. Click
12
  heading={'Basic Animated Tour'}
13
  config={{
14
  animate: true,
 
15
  showButtons: ['next', 'previous'],
16
  }}
17
  tour={[
@@ -20,6 +21,7 @@ The following example shows how to create a simple tour with a few steps. Click
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(17)', 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
  ]}
 
12
  heading={'Basic Animated Tour'}
13
  config={{
14
  animate: true,
15
+ showProgress: true,
16
  showButtons: ['next', 'previous'],
17
  }}
18
  tour={[
 
21
  { 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' }},
22
  { 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' }},
23
  { element: '.line:nth-child(17)', popover: { title: 'Start Tour', description: 'Call the drive method to start the tour and your tour will be started.', side: "top", align: 'start' }},
24
+ { element: '.line:nth-child(5)', popover: { title: 'Hide Progress', description: 'Progress shown in the bottom left is hidden by default. You can make driver show/hide the progress using this option.', side: "top", align: 'start' }},
25
  { 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' }},
26
  { popover: { title: 'Happy Coding', description: 'And that is all, go ahead and start adding tours to your applications.' } }
27
  ]}
docs/src/content/guides/static-tour.mdx ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Static Tour"
3
+ groupTitle: "Examples"
4
+ sort: 2
5
+ ---
6
+
7
+ import { CodeSample } from "../../components/CodeSample.tsx";
8
+
9
+ You can simply set `animate` option to `false` to make the tour static. This will make the tour not animate between steps and will just show the popover.
10
+
11
+ <CodeSample
12
+ heading={'Basic Static Tour'}
13
+ config={{
14
+ animate: false,
15
+ showProgress: false,
16
+ showButtons: ['next', 'previous'],
17
+ }}
18
+ tour={[
19
+ { 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' }},
20
+ { 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' }},
21
+ { 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' }},
22
+ { 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' }},
23
+ { element: '.line:nth-child(19)', popover: { title: 'Start Tour', description: 'Call the drive method to start the tour and your tour will be started.', side: "top", align: 'start' }},
24
+ { element: '.line:nth-child(6)', popover: { title: 'Hide Progress', description: 'Progress shown in the bottom left is hidden by default. You can make driver show/hide the progress using this option.', side: "top", align: 'start' }},
25
+ { 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' }},
26
+ { popover: { title: 'Happy Coding', description: 'And that is all, go ahead and start adding tours to your applications.' } }
27
+ ]}
28
+ id={"tour-example"}
29
+ client:load
30
+ >
31
+ ```js
32
+ import { driver } from "driver.js";
33
+ import "driver.js/dist/driver.css";
34
+
35
+ const driverObj = driver({
36
+ animate: false,
37
+ showProgress: false,
38
+ showButtons: ['next', 'previous', 'close'],
39
+ steps: [
40
+ { 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' }},
41
+ { 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' }},
42
+ { 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' }},
43
+ { 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' }},
44
+ { element: 'code .line:nth-child(18)', popover: { title: 'Start Tour', description: 'Call the drive method to start the tour and your tour will be started.', side: "top", align: 'start' }},
45
+ { 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' }},
46
+ { popover: { title: 'Happy Coding', description: 'And that is all, go ahead and start adding tours to your applications.' } }
47
+ ]
48
+ });
49
+
50
+ driver.drive();
51
+ ```
52
+ </CodeSample>
docs/src/pages/index.astro CHANGED
@@ -11,19 +11,19 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
11
  <BaseLayout>
12
  <div class="bg-yellow-300">
13
  <Container>
14
- <div class="py-24 flex justify-start items-center gap-4">
15
  <div class="flex-grow">
16
- <h1 class="text-9xl mb-4 font-bold">driver.js</h1>
17
- <p class="text-3xl">Product tours, highlights, contextual help and more.</p>
18
- <div class="mt-12 mb-2 flex gap-2 items-stretch">
19
- <button class="bg-black rounded-xl py-4 px-5 font-medium text-white text-xl">Show Demo Tour</button>
20
  <a href="/docs/installation"
21
  class="flex items-center font-bold text-xl border-4 border-black rounded-xl px-5 bg-white">
22
  Get Started
23
  </a>
24
  </div>
25
  </div>
26
- <div class="flex-shrink-0">
27
  <img src="/driver.svg" alt="Hero Image" class="h-72" />
28
  </div>
29
  </div>
 
11
  <BaseLayout>
12
  <div class="bg-yellow-300">
13
  <Container>
14
+ <div class="py-10 md:py-24 flex justify-start items-center gap-4">
15
  <div class="flex-grow">
16
+ <h1 class="text-5xl md:text-9xl mb-2 md:mb-4 font-bold">driver.js</h1>
17
+ <p class="text-md md:text-3xl">Product tours, highlights, contextual help and more.</p>
18
+ <div class="mt-4 md:mt-12 mb-2 flex gap-2 items-stretch">
19
+ <button class="bg-black rounded-lg md:rounded-xl py-2 md:py-4 px-5 font-medium text-white text-base md:text-xl">Show Demo Tour</button>
20
  <a href="/docs/installation"
21
  class="flex items-center font-bold text-xl border-4 border-black rounded-xl px-5 bg-white">
22
  Get Started
23
  </a>
24
  </div>
25
  </div>
26
+ <div class="flex-shrink-0 hidden md:flex">
27
  <img src="/driver.svg" alt="Hero Image" class="h-72" />
28
  </div>
29
  </div>