-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
278 lines (253 loc) · 7.21 KB
/
example.html
File metadata and controls
278 lines (253 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PixelGuide SDK Demo</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
background: #f5f5f5;
}
.header {
text-align: center;
margin-bottom: 60px;
}
h1 {
font-size: 48px;
color: #1f2937;
margin-bottom: 16px;
}
.subtitle {
font-size: 20px;
color: #6b7280;
}
.demo-section {
background: white;
border-radius: 16px;
padding: 40px;
margin-bottom: 30px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.demo-section h2 {
margin-top: 0;
color: #1f2937;
font-size: 24px;
margin-bottom: 20px;
}
.btn {
background: #6366f1;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.btn:hover {
background: #4f46e5;
transform: translateY(-1px);
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 30px;
}
.feature-card {
padding: 24px;
background: #f9fafb;
border-radius: 12px;
border: 2px solid #e5e7eb;
}
.feature-card h3 {
margin-top: 0;
color: #1f2937;
font-size: 18px;
}
.feature-card p {
color: #6b7280;
line-height: 1.6;
}
.code-block {
background: #1f2937;
color: #e5e7eb;
padding: 20px;
border-radius: 8px;
overflow-x: auto;
margin-top: 20px;
}
.code-block code {
font-family: 'Monaco', 'Courier New', monospace;
font-size: 14px;
}
</style>
</head>
<body>
<div class="header">
<h1>🎯 PixelGuide SDK</h1>
<p class="subtitle">Beautiful user onboarding and product tours</p>
</div>
<div class="demo-section" id="welcome">
<h2>Welcome Section</h2>
<p>This is a demo showcasing the PixelGuide SDK's capabilities.</p>
<button class="btn" id="start-tour">Start Interactive Tour</button>
<button class="btn" id="start-modal-tour" style="margin-left: 10px;">Try Modal Tour</button>
</div>
<div class="demo-section" id="features">
<h2>Key Features</h2>
<div class="feature-grid">
<div class="feature-card" id="feature-1">
<h3>Shadow DOM</h3>
<p>Complete style isolation using Shadow DOM technology.</p>
</div>
<div class="feature-card" id="feature-2">
<h3>Smart Positioning</h3>
<p>Powered by Floating UI for intelligent tooltip placement.</p>
</div>
<div class="feature-card" id="feature-3">
<h3>Spotlight Effect</h3>
<p>Beautiful overlays that highlight important elements.</p>
</div>
</div>
</div>
<div class="demo-section" id="usage">
<h2>Usage Example</h2>
<p>Simple and intuitive API for creating product tours:</p>
<div class="code-block">
<code>
const pg = new PixelGuide();
pg.startFlow({
id: 'onboarding',
steps: [
{
element: '#welcome',
title: 'Welcome!',
content: 'Let us show you around.'
}
]
});
</code>
</div>
</div>
<!-- Load the PixelGuide SDK -->
<script src="dist/pixelguide.js"></script>
<script>
// Initialize PixelGuide
const pg = new PixelGuide.PixelGuide({
showOverlay: true,
showProgress: true,
theme: {
primaryColor: '#6366f1',
}
});
// Define the tour
const onboardingFlow = {
id: 'onboarding-tour',
steps: [
{
element: '#welcome',
title: 'Welcome to PixelGuide! 👋',
content: 'This is an interactive tour showcasing how PixelGuide works. Click "Next" to continue.',
placement: 'bottom',
},
{
element: '#start-tour',
title: 'Start Tours Easily',
content: 'You can start tours with a simple button click or programmatically.',
placement: 'right',
},
{
element: '#features',
title: 'Powerful Features',
content: 'PixelGuide comes packed with features to create engaging user experiences.',
placement: 'top',
},
{
element: '#feature-1',
title: 'Shadow DOM Isolation',
content: 'All tooltips use Shadow DOM for complete style isolation from your app.',
placement: 'right',
},
{
element: '#feature-2',
title: 'Smart Positioning',
content: 'Tooltips automatically adjust their position to stay visible on screen.',
placement: 'top',
},
{
element: '#feature-3',
title: 'Beautiful Highlights',
content: 'Elements are highlighted with a smooth spotlight effect.',
placement: 'top',
},
{
element: '#usage',
title: 'Simple API',
content: 'The API is intuitive and easy to integrate into any project.',
placement: 'top',
},
],
onComplete: (flow) => {
console.log('Tour completed!', flow);
alert('🎉 Tour completed! Thanks for trying PixelGuide.');
},
onCancel: (flow) => {
console.log('Tour cancelled', flow);
},
};
// Define the modal tour (with modal steps)
const modalFlow = {
id: 'modal-tour',
steps: [
{
modal: true,
title: 'Welcome to Modal Mode! 🎉',
content: 'Modal steps appear as centered dialogs with a full-screen backdrop. Perfect for important announcements or step-by-step guides.',
},
{
element: '#features',
title: 'Regular Tooltip',
content: 'You can mix regular tooltips with modal steps in the same flow!',
placement: 'top',
},
{
modal: true,
title: 'Modal Features ✨',
content: '<strong>Modal steps are great for:</strong><ul style="margin: 10px 0;"><li>Important announcements</li><li>Multi-step forms</li><li>Feature introductions</li><li>Confirmation dialogs</li></ul>',
},
{
modal: true,
title: 'That\'s It!',
content: 'Modal mode gives you more flexibility in how you guide your users. Try combining modals with regular tooltips for powerful onboarding experiences!',
},
],
onComplete: (flow) => {
console.log('Modal tour completed!', flow);
},
};
// Add the flows
pg.addFlow(onboardingFlow);
pg.addFlow(modalFlow);
// Start tour on button click
document.getElementById('start-tour').addEventListener('click', () => {
pg.start('onboarding-tour');
});
// Start modal tour on button click
document.getElementById('start-modal-tour').addEventListener('click', () => {
pg.start('modal-tour');
});
// Optional: Auto-start tour after a delay
setTimeout(() => {
if (!pg.isActive()) {
pg.start('onboarding-tour');
}
}, 1000);
</script>
</body>
</html>