kamrify commited on
Commit
7660c1f
·
1 Parent(s): c73f86b

Add usecases and examples

Browse files
docs/src/components/FeatureMarquee.tsx CHANGED
@@ -9,6 +9,7 @@ const featureList = [
9
  "Light-weight",
10
  "Feature Rich",
11
  "Highly Customizable",
 
12
  "Easy to use",
13
  "Accessible",
14
  "Frameworks Ready",
@@ -21,7 +22,7 @@ export function FeatureMarquee() {
21
  <p className="py-4 text-2xl whitespace-nowrap">
22
  { featureList.map((featureItem, index) => (
23
  <React.Fragment key={index}>
24
- { featureItem } <span className="mx-3">&middot;</span>
25
  </React.Fragment>
26
  ))}
27
  </p>
 
9
  "Light-weight",
10
  "Feature Rich",
11
  "Highly Customizable",
12
+ "Supports all Major Browsers",
13
  "Easy to use",
14
  "Accessible",
15
  "Frameworks Ready",
 
22
  <p className="py-4 text-2xl whitespace-nowrap">
23
  { featureList.map((featureItem, index) => (
24
  <React.Fragment key={index}>
25
+ { featureItem }<span className="mx-3">&middot;</span>
26
  </React.Fragment>
27
  ))}
28
  </p>
docs/src/components/UsecaseItem.astro ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ export interface Props {
3
+ title: string;
4
+ description: string;
5
+ }
6
+
7
+ const { title, description } = Astro.props;
8
+ ---
9
+
10
+ <div class="flex flex-col gap-4">
11
+ <span class="border-b-2 border-b-yellow-300 block w-[50px]"></span>
12
+ <h3 class="text-3xl font-bold text-yellow-300">
13
+ { title }
14
+ </h3>
15
+ <p class="text-xl text-gray-300">
16
+ { description }
17
+ </p>
18
+ </div>
docs/src/components/examples/ExampleButton.tsx ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ type ExampleButtonProps = {
2
+ onClick: () => void;
3
+ text: string;
4
+ };
5
+
6
+ export function ExampleButton(props: ExampleButtonProps) {
7
+ const { onClick, text } = props;
8
+
9
+ return (
10
+ <button
11
+ onClick={onClick}
12
+ className="bg-transparent rounded-xl py-2 px-4 font-medium text-yellow-300 border-2 border-yellow-300 text-lg hover:bg-yellow-300 hover:text-black transition-colors duration-100">
13
+ { text }
14
+ </button>
15
+ );
16
+ }
docs/src/pages/index.astro CHANGED
@@ -2,6 +2,8 @@
2
  import BaseLayout from "../layouts/BaseLayout.astro";
3
  import { FeatureMarquee } from "../components/FeatureMarquee";
4
  import Container from "../components/Container.astro";
 
 
5
  ---
6
  <BaseLayout>
7
  <div class="bg-yellow-300">
@@ -27,46 +29,52 @@ import Container from "../components/Container.astro";
27
  <FeatureMarquee client:load />
28
  </div>
29
 
30
- <div class="py-24 bg-black text-white">
31
  <Container>
32
- <h2 class="text-5xl font-bold mb-4">Usecases</h2>
33
- <p class="text-2xl mb-16 text-gray-300">Due to it's extensive API, driver.js can be used for a wide range of use cases.</p>
34
- <div class="grid grid-cols-1 md:grid-cols-2 gap-12">
35
- <div class="flex flex-col gap-4">
36
- <span class="border-b border-b-yellow-300 block w-[50px]"></span>
37
- <h3 class="text-3xl font-bold text-yellow-300">Onboard Users</h3>
38
- <p class="text-xl text-gray-300">
39
- Onboard your users by explaining how to use your product and answer common
40
- questions.
41
- </p>
42
- </div>
43
 
44
- <div class="flex flex-col gap-4">
45
- <span class="border-b border-b-yellow-300 block w-[50px]"></span>
46
- <h3 class="text-3xl font-bold text-yellow-300">
47
- Remove Distractions
48
- </h3>
49
- <p class="text-xl text-gray-300">
50
- With highlight feature, you can remove distractions and focus your users attention on what matters.
51
- </p>
52
- </div>
53
-
54
- <div class="flex flex-col gap-4">
55
- <span class="border-b border-b-yellow-300 block w-[50px]"></span>
56
- <h3 class="text-3xl font-bold text-yellow-300">Contextual Help</h3>
57
- <p class="text-xl text-gray-300">
58
- Provide contextual help for your users, explain how to use your product and answer common questions.
59
- </p>
60
- </div>
 
61
 
62
- <div class="flex flex-col gap-4">
63
- <span class="border-b border-b-yellow-300 block w-[50px]"></span>
64
- <h3 class="text-3xl font-bold text-yellow-300">Feature Adoption</h3>
65
- <p class="text-xl text-gray-300">
66
- Highlight new features, explain how to use them and make sure your users don't miss them.
67
- </p>
68
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
69
  </div>
70
  </Container>
71
  </div>
 
72
  </BaseLayout>
 
2
  import BaseLayout from "../layouts/BaseLayout.astro";
3
  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">
 
29
  <FeatureMarquee client:load />
30
  </div>
31
 
32
+ <div class="py-32 bg-black text-white">
33
  <Container>
34
+ <h2 class="text-6xl font-bold mb-6">Examples</h2>
35
+ <p class="text-2xl text-gray-300 mb-12">Here are just a few examples; find more <a
36
+ class="text-yellow-300 underline underline-offset-4" href="#">in the documentation</a>.</p>
 
 
 
 
 
 
 
 
37
 
38
+ <div class="flex flex-wrap gap-3">
39
+ <ExampleButton text="Animated Tour" />
40
+ <ExampleButton text="Non-Animated Tour" />
41
+ <ExampleButton text="Asynchronous Tour" />
42
+ <ExampleButton text="Confirm on Exit" />
43
+ <ExampleButton text="Show Progress" />
44
+ <ExampleButton text="Simple Element Highlight" />
45
+ <ExampleButton text="Prevent Tour from Closing" />
46
+ <ExampleButton text="Selective Popover Buttons" />
47
+ <ExampleButton text="Overlay Color" />
48
+ <ExampleButton text="Popover Positioning" />
49
+ <ExampleButton text="Customizing Popover" />
50
+ <ExampleButton text="Hooks for Everything" />
51
+ <a href="/"
52
+ class="items-center flex text-lg text-gray-900 bg-yellow-300 rounded-xl px-5 hover:bg-yellow-500 hover:text-black">
53
+ and much more ...
54
+ </a>
55
+ </div>
56
 
57
+ <p class="text-2xl my-14 text-gray-300">Due to it's extensive API, driver.js can be used for a wide range of use
58
+ cases.</p>
59
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-12">
60
+ <UsecaseItem
61
+ title="Onboard Users"
62
+ description="Onboard your users by explaining how to use your product and answer common questions."
63
+ />
64
+ <UsecaseItem
65
+ title="Remove Distractions"
66
+ description="With highlight feature, you can remove distractions and focus your users attention on what matters."
67
+ />
68
+ <UsecaseItem
69
+ title="Contextual Help"
70
+ description="Provide contextual help for your users, explain how to use your product and answer common questions."
71
+ />
72
+ <UsecaseItem
73
+ title="Feature Adoption"
74
+ description="Highlight new features, explain how to use them and make sure your users don't miss them."
75
+ />
76
  </div>
77
  </Container>
78
  </div>
79
+
80
  </BaseLayout>
src/popover.ts CHANGED
@@ -102,7 +102,6 @@ export function renderPopover(element: Element, step: DriveStep) {
102
  const showFooter =
103
  showButtonsConfig?.includes("next") ||
104
  showButtonsConfig?.includes("previous") ||
105
- showButtonsConfig?.includes("close") ||
106
  showProgressConfig;
107
 
108
  popover.closeButton.style.display = showButtonsConfig.includes("close") ? "block" : "none";
@@ -160,7 +159,10 @@ export function renderPopover(element: Element, step: DriveStep) {
160
  // If the user has provided a custom callback, call it
161
  // otherwise, emit the event.
162
  if (onNextClick) {
163
- return onNextClick(element, step);
 
 
 
164
  } else {
165
  return emit("nextClick");
166
  }
@@ -168,7 +170,10 @@ export function renderPopover(element: Element, step: DriveStep) {
168
 
169
  if (target.classList.contains("driver-popover-prev-btn")) {
170
  if (onPrevClick) {
171
- return onPrevClick(element, step);
 
 
 
172
  } else {
173
  return emit("prevClick");
174
  }
@@ -176,7 +181,10 @@ export function renderPopover(element: Element, step: DriveStep) {
176
 
177
  if (target.classList.contains("driver-popover-close-btn")) {
178
  if (onCloseClick) {
179
- return onCloseClick(element, step);
 
 
 
180
  } else {
181
  return emit("closeClick");
182
  }
 
102
  const showFooter =
103
  showButtonsConfig?.includes("next") ||
104
  showButtonsConfig?.includes("previous") ||
 
105
  showProgressConfig;
106
 
107
  popover.closeButton.style.display = showButtonsConfig.includes("close") ? "block" : "none";
 
159
  // If the user has provided a custom callback, call it
160
  // otherwise, emit the event.
161
  if (onNextClick) {
162
+ return onNextClick(element, step, {
163
+ config: getConfig(),
164
+ state: getState(),
165
+ });
166
  } else {
167
  return emit("nextClick");
168
  }
 
170
 
171
  if (target.classList.contains("driver-popover-prev-btn")) {
172
  if (onPrevClick) {
173
+ return onPrevClick(element, step, {
174
+ config: getConfig(),
175
+ state: getState(),
176
+ });
177
  } else {
178
  return emit("prevClick");
179
  }
 
181
 
182
  if (target.classList.contains("driver-popover-close-btn")) {
183
  if (onCloseClick) {
184
+ return onCloseClick(element, step, {
185
+ config: getConfig(),
186
+ state: getState(),
187
+ });
188
  } else {
189
  return emit("closeClick");
190
  }