Skip to content

Commit 44a05bd

Browse files
authored
Merge pull request #7 from GlobalHive/develop
Merge into master
2 parents dff9ff6 + d35877b commit 44a05bd

9 files changed

Lines changed: 91 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
> VueJS Tour is a lightweight, simple and customizable tour plugin.
1111
> It provides a quick and easy way to guide your users through your application.
1212
13+
<a href="https://globalhive.github.io/vuejs-tour/"><img src="./vuejs-tour.gif" width="100%"/></a>
14+
1315
## Table of Contents
1416

1517
- [Prerequisites](#prerequisites)

docs/.vuepress/client.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineClientConfig } from '@vuepress/client'
2+
import VTour from '../../src/components/VTour.vue'
3+
4+
export default defineClientConfig({
5+
enhance({ app, router, siteData }) {
6+
app.component('VTour', VTour);
7+
},
8+
setup() {},
9+
rootComponents: [
10+
'VTour',
11+
],
12+
})

docs/.vuepress/config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ export default defineUserConfig({
1010
vuePluginOptions: {},
1111
}),
1212
theme: defaultTheme({
13+
logo: 'https://vuejs.org/images/logo.png',
1314
repo: 'globalhive/vuejs-tour',
15+
docsRepo: 'globalhive/vuejs-tour',
16+
docsDir: 'docs',
17+
docsBranch: 'master',
18+
navbar: [
19+
{
20+
text: 'API',
21+
link: '/guide/props',
22+
}
23+
],
1424
sidebar: [
1525
{
1626
text: 'Introduction',

docs/index.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
home: true
3-
//heroImage: /images/popper.svg
4-
//heroAlt: VueJS Tour Logo
3+
heroImage: https://vuejs.org/images/logo.png
54
tagline: Guide your users through your application quickly and easily.
65
footer: MIT Licensed | Made with ❤️ by <a href="https://github.com/GlobalHive/vuejs-tour">Global Hive</a>
76
footerHtml: true
7+
title: Home
88
actions:
99
- text: Get Started →
1010
link: /guide/getting-started
@@ -16,3 +16,40 @@ features:
1616
- title: 🎨 Themeable
1717
details: VueJS Tour uses sass/scss to make it easy to customize the look of your tour.
1818
---
19+
20+
<VTour :steps="steps" ref="tour" highlight/>
21+
22+
<script setup>
23+
import { onMounted, ref } from "vue";
24+
const tour = ref(null);
25+
const steps = [
26+
{
27+
target: ".hero img",
28+
content: "Welcome to the VueJS Tour documentation!",
29+
},
30+
{
31+
target: ".footer a",
32+
content: 'Made with ❤️ by <a href="https://github.com/globalhive">Global Hive</a>',
33+
},
34+
{
35+
target: ".navbar-item a",
36+
content: '<br><center>Looking for the API?</center><br>',
37+
},
38+
{
39+
target: ".description",
40+
content: 'With full <b>HTML</b> <u>support</u> <i>for the content of your steps!</i><br><br><img src="https://i.giphy.com/media/D6WuLOKOpR2fK/giphy.webp">',
41+
placement: "right",
42+
},
43+
{
44+
target: ".actions a",
45+
content: "Let's get started, shall we?",
46+
placement: "right",
47+
}
48+
];
49+
onMounted(() => {
50+
tour.value.resetTour();
51+
});
52+
</script>
53+
<style lang="scss">
54+
@import "../src/style/style.scss";
55+
</style>

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
},
4545
"dependencies": {
4646
"@popperjs/core": "^2.11.6",
47+
"jump.js": "^1.0.2",
4748
"vue": "^3.2.41"
4849
},
4950
"repository": {

src/components/VTour.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<script setup>
1818
import { createPopper } from "@popperjs/core";
1919
import { computed, onMounted, ref } from "vue";
20+
import jump from "jump.js";
2021
2122
const popper = ref(null);
2223
@@ -102,6 +103,9 @@ function endTour() {
102103
document.querySelector(".vjt-highlight").classList.remove("vjt-highlight");
103104
popper.value.destroy();
104105
localStorage.setItem("vjt-tour", "true");
106+
jump(document.body, {
107+
duration: 500,
108+
});
105109
}
106110
107111
function resetTour() {
@@ -111,10 +115,12 @@ function resetTour() {
111115
}
112116
113117
function highlightTarget(lastStep = null) {
114-
document.querySelector(`${getStep.value.target}`).classList.add("vjt-highlight");
115-
if (lastStep != null) {
116-
document.querySelector(`${props.steps[lastStep].target}`).classList.remove("vjt-highlight");
117-
}
118+
let _nextStep = document.querySelector(`${getStep.value?.target}`);
119+
let _lastStep = document.querySelector(`${props.steps[lastStep]?.target}`);
120+
if(_nextStep === _lastStep) return;
121+
122+
_nextStep.classList.add("vjt-highlight");
123+
if (_lastStep != null) _lastStep.classList.remove("vjt-highlight");
118124
}
119125
120126
function recalculatePopper(lastStep) {
@@ -123,7 +129,11 @@ function recalculatePopper(lastStep) {
123129
});
124130
popper.value.state.elements.reference = document.querySelector(`${getStep.value.target}`);
125131
popper.value.update();
126-
highlightTarget(lastStep);
132+
jump(document.querySelector(`${getStep.value.target}`), {
133+
duration: 500,
134+
offset: -100
135+
});
136+
props.highlight ? highlightTarget(lastStep) : null;
127137
}
128138
129139
onMounted(() => {

src/style/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
font-size: $vjt__action_button_font_size;
8181
font-weight: 500;
8282
transition: all 0.2s ease-in-out;
83+
cursor: pointer;
8384

8485
&:hover {
8586
background-color: $vjt__action_button_background_hover;

vuejs-tour.gif

857 KB
Loading

0 commit comments

Comments
 (0)