kamrify commited on
Commit
8aca263
·
1 Parent(s): 7ba1a91

Add demo tour on homepage

Browse files
Files changed (1) hide show
  1. docs/src/pages/index.astro +101 -7
docs/src/pages/index.astro CHANGED
@@ -11,13 +11,16 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
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>
@@ -29,7 +32,7 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
29
  </div>
30
  </Container>
31
  </div>
32
- <div class="bg-white overflow-x-hidden relative h-[64px] border-b-2 border-b-black">
33
  <FeatureMarquee client:only />
34
  </div>
35
 
@@ -39,7 +42,7 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
39
  <p class="text-2xl text-black mb-12">Here are just a few examples; find more <a
40
  class="text-black underline underline-offset-4" href="/docs/installation">in the documentation</a>.</p>
41
 
42
- <div class="flex flex-wrap gap-3">
43
  <ExampleButton text="Animated Tour" />
44
  <ExampleButton text="Non-Animated Tour" />
45
  <ExampleButton text="Asynchronous Tour" />
@@ -93,6 +96,7 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
93
 
94
  <div class="flex gap-3">
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>
@@ -127,4 +131,94 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
127
  </p>
128
  </Container>
129
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  </BaseLayout>
 
11
  <BaseLayout>
12
  <div class="bg-yellow-300">
13
  <Container>
14
+ <div class="py-10 md:py-20 flex justify-start items-center gap-4">
15
+ <div class="flex-grow" data-hero-text>
16
+ <h1 data-driver-name class="text-5xl md:text-9xl mb-2 md:mb-4 font-bold">driver.js</h1>
17
+ <p data-driver-tagline 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 data-demo-tour class="bg-black rounded-lg md:rounded-xl py-2 md:py-4 px-5 font-medium text-white text-base md:text-xl focus:outline-0">
20
+ Show Demo Tour
21
+ </button>
22
  <a href="/docs/installation"
23
+ data-docs-link
24
  class="flex items-center font-bold text-xl border-4 border-black rounded-xl px-5 bg-white">
25
  Get Started
26
  </a>
 
32
  </div>
33
  </Container>
34
  </div>
35
+ <div class="bg-white overflow-x-hidden overflow-y-hidden relative h-[64px] border-b-2 border-b-black" data-feat-marquee>
36
  <FeatureMarquee client:only />
37
  </div>
38
 
 
42
  <p class="text-2xl text-black mb-12">Here are just a few examples; find more <a
43
  class="text-black underline underline-offset-4" href="/docs/installation">in the documentation</a>.</p>
44
 
45
+ <div class="flex flex-wrap gap-3" data-example-btns>
46
  <ExampleButton text="Animated Tour" />
47
  <ExampleButton text="Non-Animated Tour" />
48
  <ExampleButton text="Asynchronous Tour" />
 
96
 
97
  <div class="flex gap-3">
98
  <a href="https://github.com/kamranahmedse/driver.js"
99
+ data-github-link
100
  target="_blank"
101
  class="flex items-center font-bold text-2xl rounded-xl py-3 px-5 bg-yellow-300 border-black hover:bg-yellow-400">
102
  <span class="mr-3 inline-flex items-center"><img src="/star.svg" alt="Hero Image" class="h-7 mr-2" /> { starCount }</span>
 
131
  </p>
132
  </Container>
133
  </div>
134
+
135
+ <script>
136
+ import { driver } from "driver.js";
137
+ import "driver.js/dist/driver.css";
138
+
139
+ const driverObj = driver({
140
+ popoverClass: "driverjs-theme",
141
+ showButtons: ["next", "previous"],
142
+ steps: [
143
+ {
144
+ element: "[data-hero-text]",
145
+ popover: {
146
+ title: "Before we start",
147
+ description: "This is just one use-case, make sure to look at the docs for more use-cases and examples.",
148
+ nextBtnText: "Okay, start!",
149
+ side: "bottom",
150
+ align: "start"
151
+ }
152
+ },
153
+ {
154
+ element: "[data-driver-tagline]",
155
+ popover: {
156
+ title: "Focus Anything",
157
+ description: "You can use it to highlight literally anything, images, text, svg, div, span, li etc.",
158
+ side: "bottom",
159
+ align: "start"
160
+ }
161
+ },
162
+ {
163
+ element: "[data-driver-name]",
164
+ popover: {
165
+ title: "Why Driver.js",
166
+ description: "It's lightweight, has no dependencies, is MIT licensed, is highly customizable, and is super easy to use.",
167
+ side: "bottom",
168
+ align: "start"
169
+ }
170
+ },
171
+ {
172
+ element: "[data-docs-link]",
173
+ popover: {
174
+ title: "More Powerful than Ever",
175
+ description: "Driver.js has been completely rewritten from scratch and is now more powerful than ever.",
176
+ side: "bottom",
177
+ align: "start"
178
+ }
179
+ },
180
+ {
181
+ element: "[data-example-btns]",
182
+ popover: {
183
+ title: "Examples",
184
+ description: "Here are some examples to give you a rough idea.",
185
+ side: "bottom",
186
+ align: "start"
187
+ }
188
+ },
189
+ {
190
+ element: "[data-example-btns] a:last-child",
191
+ popover: {
192
+ title: "Visit Docs",
193
+ description: "Make sure to visit the docs for more examples and use-cases.",
194
+ side: "top",
195
+ align: "start"
196
+ }
197
+ },
198
+ {
199
+ element: "[data-github-link]",
200
+ popover: {
201
+ title: "MIT Licensed",
202
+ description: "Driver.js is MIT licensed and is used by thousands of companies around the world.",
203
+ side: "top",
204
+ align: "start"
205
+ }
206
+ },
207
+ {
208
+ popover: {
209
+ description: "<img style='width: 270px; height: 206.65px; margin-bottom: 10px; border-radius: 5px;' src='https://i.imgur.com/3WpTnyA.gif' />That's it for now, make sure to visit the docs for more examples and use-cases.",
210
+ side: "bottom",
211
+ align: "start",
212
+ showButtons: [],
213
+ popoverClass: "default-theme"
214
+ }
215
+ }
216
+ ]
217
+ });
218
+
219
+ const demoTourButton = document.querySelector("[data-demo-tour]");
220
+ demoTourButton.addEventListener("click", () => {
221
+ driverObj.drive();
222
+ });
223
+ </script>
224
  </BaseLayout>