File tree Expand file tree Collapse file tree 4 files changed +63
-5
lines changed Expand file tree Collapse file tree 4 files changed +63
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ const route = useRoute()
11
11
provide (' navigation' , computed (() => {
12
12
return route .path .startsWith (' /docs' ) ? navigation .value ?.[0 ]?.children : navigation .value ?.[1 ]?.children || []
13
13
}))
14
+ provide (' topGuides' , computed (() => {
15
+ return navigation .value ?.[0 ]?.children .find (nav => nav .title === ' Guides' )?.children || []
16
+ }))
14
17
</script >
15
18
16
19
<template >
Original file line number Diff line number Diff line change 1
1
<script lang="ts" setup>
2
+ import type { NavItem } from ' @nuxt/content'
3
+ import type { Ref } from ' vue'
2
4
5
+ const topGuides = inject <Ref <NavItem []>>(' topGuides' )
3
6
</script >
4
7
5
8
<template >
35
38
</h3 >
36
39
<nav >
37
40
<ul class =" grid grid-cols-2 gap-6" >
38
- <li v-for =" (module, key) in modules" :key =" key" >
39
- <NuxtLink :to =" module.to" >
40
- <Icon :name =" module.icon" />
41
- {{ module.label }}
41
+ <li v-for =" (module, key) in topGuides" :key =" key" >
42
+ <NuxtLink :to =" module._path" >
43
+ {{ module.title }}
42
44
</NuxtLink >
43
45
</li >
44
46
</ul >
Original file line number Diff line number Diff line change 1
1
---
2
- title : Analytics Page Events
2
+ title : Script Event Page
3
3
description : Learn how to send page events to your analytics provider.
4
4
---
5
5
Original file line number Diff line number Diff line change @@ -52,6 +52,42 @@ onMounted(() => {
52
52
})
53
53
})
54
54
})
55
+
56
+ interface JSConfettiApi {
57
+ // JSConfetti is a class
58
+ JSConfetti: {
59
+ new (): {
60
+ addConfetti: (options ? : { emojis: string [] }) => void
61
+ }
62
+ }
63
+ }
64
+ declare global {
65
+ interface Window {
66
+ JSConfetti: { new (): JSConfettiApi }
67
+ }
68
+ }
69
+
70
+ const confettiEl = ref ()
71
+ const { $script } = useScript <JSConfettiApi >({
72
+ key: ' confetti' ,
73
+ src: ' https://cdn.jsdelivr.net/npm/js-confetti@latest/dist/js-confetti.browser.js' ,
74
+ }, {
75
+ trigger: useScriptTriggerElement ({
76
+ trigger: ' visibility' ,
77
+ el: confettiEl ,
78
+ }),
79
+ use() {
80
+ return { JSConfetti: window .JSConfetti }
81
+ },
82
+ })
83
+ onMounted (() => {
84
+ confettiEl .value && useEventListener (confettiEl .value , ' mouseenter' , () => {
85
+ $script .then (({ JSConfetti }) => {
86
+ new JSConfetti ().addConfetti ({ emojis: [' 🎉' , ' 🎊' ] })
87
+ })
88
+ })
89
+ })
90
+
55
91
const links = [
56
92
{
57
93
label: ' Get started' ,
@@ -392,6 +428,23 @@ const contributors = useRuntimeConfig().public.contributors
392
428
</div>
393
429
</div>
394
430
</ULandingSection>
431
+ <ULandingSection :ui="{ wrapper: 'pt-0 py-6 sm:py-14' }">
432
+ <ULandingCTA
433
+ description="Learn all of the fundamentals of Nuxt Scripts in the fun interactive confetti tutorial."
434
+ card
435
+ >
436
+ <template #title>
437
+ Try out our JS Confetti Tutorial
438
+ </template>
439
+ <template #links>
440
+ <div ref="confettiEl">
441
+ <UButton size="xl" variant="solid" icon="i-ph-sparkle-duotone" color="primary" to="/docs/guides/confetti-tutorial">
442
+ Get started
443
+ </UButton>
444
+ </div>
445
+ </template>
446
+ </ULandingCTA>
447
+ </ULandingSection>
395
448
</div>
396
449
</template>
397
450
You can’t perform that action at this time.
0 commit comments