Skip to content

Commit e9e464a

Browse files
committed
doc: home page improvements
1 parent 30e1768 commit e9e464a

File tree

4 files changed

+63
-5
lines changed

4 files changed

+63
-5
lines changed

docs/app.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const route = useRoute()
1111
provide('navigation', computed(() => {
1212
return route.path.startsWith('/docs') ? navigation.value?.[0]?.children : navigation.value?.[1]?.children || []
1313
}))
14+
provide('topGuides', computed(() => {
15+
return navigation.value?.[0]?.children.find(nav => nav.title === 'Guides')?.children || []
16+
}))
1417
</script>
1518

1619
<template>

docs/components/Footer.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<script lang="ts" setup>
2+
import type { NavItem } from '@nuxt/content'
3+
import type { Ref } from 'vue'
24
5+
const topGuides = inject<Ref<NavItem[]>>('topGuides')
36
</script>
47

58
<template>
@@ -35,10 +38,9 @@
3538
</h3>
3639
<nav>
3740
<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 }}
4244
</NuxtLink>
4345
</li>
4446
</ul>

docs/content/docs/1.guides/3.page-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Analytics Page Events
2+
title: Script Event Page
33
description: Learn how to send page events to your analytics provider.
44
---
55

docs/pages/index.vue

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,42 @@ onMounted(() => {
5252
})
5353
})
5454
})
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+
5591
const links = [
5692
{
5793
label: 'Get started',
@@ -392,6 +428,23 @@ const contributors = useRuntimeConfig().public.contributors
392428
</div>
393429
</div>
394430
</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>
395448
</div>
396449
</template>
397450

0 commit comments

Comments
 (0)