kamrify commited on
Commit
06ca3cc
·
1 Parent(s): 2d06ce3

Add examples on homepage

Browse files
Files changed (1) hide show
  1. docs/src/pages/index.astro +84 -7
docs/src/pages/index.astro CHANGED
@@ -45,16 +45,17 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
45
  <div class="flex flex-wrap gap-3" data-example-btns>
46
  <ExampleButton id="animated-tour" text="Animated Tour" />
47
  <ExampleButton id="static-tour" text="Non-Animated Tour" />
48
- <ExampleButton id="async-tour" text="Asynchronous Tour" />
 
49
  <ExampleButton id="confirm-on-exit" text="Confirm on Exit" />
50
  <ExampleButton id="show-progress" text="Show Progress" />
51
- <ExampleButton id="simple-element-highlight" text="Simple Element Highlight" />
52
- <ExampleButton id="simple-element-highlight-popover" text="Simple Highlight with Popover" />
53
- <ExampleButton id="prevent-close" text="Prevent Tour from Closing" />
54
  <ExampleButton id="overlay-color" text="Overlay Color" />
55
- <ExampleButton text="Popover Positioning" />
56
- <ExampleButton text="Customizing Popover" />
57
- <ExampleButton text="Hooks for Everything" />
58
  <a href="/docs/installation"
59
  class="items-center flex text-lg text-gray-900 bg-yellow-300 rounded-xl px-5 hover:bg-yellow-500 hover:text-black">
60
  and much more ...
@@ -492,6 +493,23 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
492
  });
493
  });
494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  const preventCloseBtn = document.getElementById('prevent-close');
496
  preventCloseBtn.addEventListener('click', () => {
497
  const driverObj = driver({
@@ -555,5 +573,64 @@ const starCount = getFormattedStars('kamranahmedse/driver.js');
555
  }
556
  });
557
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  </script>
559
  </BaseLayout>
 
45
  <div class="flex flex-wrap gap-3" data-example-btns>
46
  <ExampleButton id="animated-tour" text="Animated Tour" />
47
  <ExampleButton id="static-tour" text="Non-Animated Tour" />
48
+ <ExampleButton id="async-tour" text="Async Tour" />
49
+ <ExampleButton id="no-element" text="No Element" />
50
  <ExampleButton id="confirm-on-exit" text="Confirm on Exit" />
51
  <ExampleButton id="show-progress" text="Show Progress" />
52
+ <ExampleButton id="simple-element-highlight" text="Simple Highlight" />
53
+ <ExampleButton id="simple-element-highlight-popover" text="Highlight with Popover" />
54
+ <ExampleButton id="prevent-close" text="Prevent Closing" />
55
  <ExampleButton id="overlay-color" text="Overlay Color" />
56
+ <ExampleButton id="popover-position" text="Popover Positioning" />
57
+ <ExampleButton id="customizing-popover" text="Customizing Popover" />
58
+ <ExampleButton id="hooks-everything" text="Hooks for Everything" />
59
  <a href="/docs/installation"
60
  class="items-center flex text-lg text-gray-900 bg-yellow-300 rounded-xl px-5 hover:bg-yellow-500 hover:text-black">
61
  and much more ...
 
493
  });
494
  });
495
 
496
+ const noElementbtn = document.getElementById('no-element');
497
+ noElementbtn.addEventListener('click', () => {
498
+ const driverObj = driver({
499
+ popoverClass: 'driverjs-theme',
500
+ onDestroyed: () => {
501
+ markDone(noElementbtn);
502
+ }
503
+ });
504
+
505
+ driverObj.highlight({
506
+ popover: {
507
+ title: "Without Element",
508
+ description: "You can also show a popover without highlighting an element. For example, this popover is shown without highlighting anything.",
509
+ }
510
+ });
511
+ });
512
+
513
  const preventCloseBtn = document.getElementById('prevent-close');
514
  preventCloseBtn.addEventListener('click', () => {
515
  const driverObj = driver({
 
573
  }
574
  });
575
  });
576
+
577
+ const popoverPositionBtn = document.getElementById('popover-position');
578
+ popoverPositionBtn.addEventListener('click', () => {
579
+ const driverObj = driver({
580
+ onDestroyed: () => {
581
+ markDone(popoverPositionBtn);
582
+ }
583
+ });
584
+
585
+ driverObj.highlight({
586
+ element: '#popover-position',
587
+ popover: {
588
+ title: "Popover Position",
589
+ description: "You can also change the position of the popover using `side` and `align` options.<br /> Allowed sides are `top`, `bottom`, `left` and `right`. Allowed aligns are `start`, `center` and `end`.",
590
+ side: 'top',
591
+ align: 'start'
592
+ }
593
+ });
594
+ });
595
+
596
+ const customizingBtn = document.getElementById('customizing-popover');
597
+ customizingBtn.addEventListener('click', () => {
598
+ const driverObj = driver({
599
+ popoverClass: 'driverjs-theme',
600
+ onDestroyed: () => {
601
+ markDone(customizingBtn);
602
+ }
603
+ });
604
+
605
+ driverObj.highlight({
606
+ element: '#customizing-popover',
607
+ popover: {
608
+ title: "Customizing Popover",
609
+ description: "Add your own class using `popoverClass` or use `onPopoverRendered` to get full control over the popover. <br /><br /> Visit these pages which cover <a class='font-medium underline' href='/docs/styling-popover'>styling</a> and <a class='font-medium underline' href='/docs/buttons'>customizing popovers</a> in detail.",
610
+ side: 'top',
611
+ align: 'start'
612
+ }
613
+ });
614
+ });
615
+
616
+ const hooksEverythingBtn = document.getElementById('hooks-everything');
617
+ hooksEverythingBtn.addEventListener('click', () => {
618
+ const driverObj = driver({
619
+ popoverClass: 'driverjs-theme',
620
+ onDestroyed: () => {
621
+ markDone(hooksEverythingBtn);
622
+ }
623
+ });
624
+
625
+ driverObj.highlight({
626
+ element: '#hooks-everything',
627
+ popover: {
628
+ title: "Hooks for Everything",
629
+ description: "Have a look at the <a class='font-medium underline' href='/docs/configuration'>configuration</a> page to see how you can use hooks to control the driver.",
630
+ side: 'top',
631
+ align: 'start'
632
+ }
633
+ });
634
+ });
635
  </script>
636
  </BaseLayout>