Skip to content

Commit f4de446

Browse files
committed
docs: add learn section and carbon ads
1 parent 5953fa1 commit f4de446

File tree

7 files changed

+225
-2
lines changed

7 files changed

+225
-2
lines changed

docs/components/Header.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const links = [
1414
to: '/scripts',
1515
icon: 'i-ph-floppy-disk-duotone',
1616
},
17+
{
18+
label: 'Learn',
19+
to: '/learn',
20+
icon: 'i-ph-floppy-disk-duotone',
21+
},
1722
]
1823
</script>
1924

docs/components/ads/Ads.vue

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<template>
2+
<div class="space-y-3">
3+
<ScriptCarbonAds
4+
:key="$route.path"
5+
class="Carbon border border-gray-200 dark:border-gray-800 rounded-lg bg-white dark:bg-white/5"
6+
serve="CW7DP537"
7+
placement="scriptsnuxtcom"
8+
>
9+
<AdsFallback />
10+
</ScriptCarbonAds>
11+
</div>
12+
</template>
13+
14+
<style lang="postcss">
15+
.dark .Carbon {
16+
min-height: 220px;
17+
.carbon-text {
18+
@apply text-gray-400;
19+
20+
&:hover {
21+
@apply text-gray-200;
22+
}
23+
}
24+
}
25+
26+
.light .Carbon {
27+
.carbon-text {
28+
@apply text-gray-600;
29+
30+
&:hover {
31+
@apply text-gray-800;
32+
}
33+
}
34+
}
35+
36+
.Carbon {
37+
@apply p-3 flex flex-col max-w-full;
38+
39+
@screen sm {
40+
@apply max-w-xs;
41+
}
42+
43+
@screen lg {
44+
@apply mt-0;
45+
}
46+
47+
#carbonads span {
48+
@apply flex flex-col justify-between;
49+
50+
.carbon-wrap {
51+
@apply flex flex-col;
52+
53+
flex: 1;
54+
55+
@media (min-width: 320px) {
56+
@apply flex-row;
57+
}
58+
59+
@screen lg {
60+
@apply flex-col;
61+
}
62+
63+
.carbon-img {
64+
@apply flex items-start justify-center mb-4;
65+
66+
@media (min-width: 320px) {
67+
@apply mb-0;
68+
}
69+
70+
@screen lg {
71+
@apply mb-4;
72+
}
73+
}
74+
75+
.carbon-text {
76+
@apply flex-1 text-sm w-full m-0 text-left block;
77+
78+
&:hover {
79+
@apply no-underline;
80+
}
81+
82+
@media (min-width: 320px) {
83+
@apply ml-4;
84+
}
85+
86+
@screen lg {
87+
@apply ml-0;
88+
}
89+
}
90+
}
91+
}
92+
93+
img {
94+
@apply w-full;
95+
}
96+
97+
& .carbon-poweredby {
98+
@apply ml-2 text-xs text-right text-gray-400 block pt-2;
99+
100+
&:hover {
101+
@apply no-underline text-gray-500;
102+
}
103+
}
104+
}
105+
</style>

docs/components/ads/AdsFallback.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div class="nui-support-nuxt">
3+
<div>
4+
<p class="pt-2 m-0 font-bold sm:text-sm text-gray-900 dark:text-white">
5+
Nuxt SEO needs you!
6+
</p>
7+
<p class="pb-2 m-0 leading-normal text-gray-600 dark:text-white sm:text-xs">
8+
By allowing nuxtseo.com on your Ad-Blocker, you support our work and help us financially.
9+
</p>
10+
</div>
11+
</div>
12+
</template>
13+
14+
<style lang="postcss">
15+
.nui-support-nuxt {
16+
@apply py-2 px-4 rounded-md bg-gray-100 dark:bg-white dark:bg-opacity-10 flex flex-row w-full items-center mt-4;
17+
}
18+
19+
@screen sm {
20+
.nui-support-nuxt {
21+
@apply flex-col w-40 mt-0;
22+
}
23+
}
24+
</style>

docs/nuxt.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineNuxtConfig } from 'nuxt/config'
22
import { $fetch } from 'ofetch'
3+
import { isDevelopment } from 'std-env'
34

45
// https://nuxt.com/docs/api/configuration/nuxt-config
56
export default defineNuxtConfig({
@@ -16,7 +17,14 @@ export default defineNuxtConfig({
1617
'@nuxt/image',
1718
async (_, nuxt) => {
1819
// build time for caching
19-
const { contributors } = await $fetch(`https://api.nuxt.com/modules/scripts`)
20+
const { contributors } = await $fetch(`https://api.nuxt.com/modules/scripts`).catch(() => {
21+
if (isDevelopment) {
22+
return {
23+
contributors: [],
24+
}
25+
}
26+
throw new Error('Failed to fetch contributors')
27+
})
2028
nuxt.options.runtimeConfig.public.contributors = contributors.map(m => m.id)
2129
},
2230
],

docs/pages/[...slug].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const links = computed(() => [toc?.bottom?.edit && {
5454
<template v-if="toc?.bottom" #bottom>
5555
<div class="hidden lg:block space-y-6" :class="{ '!mt-6': page.body?.toc?.links?.length }">
5656
<UDivider v-if="page.body?.toc?.links?.length" type="dashed" />
57-
57+
<Ads class="mb-5" />
5858
<UPageLinks :title="toc.bottom.title" :links="links" />
5959
</div>
6060
</template>

docs/pages/index.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,32 @@ const contributors = useRuntimeConfig().public.contributors
424424
</div>
425425
</div>
426426
</ULandingSection>
427+
428+
<ULandingSection :ui="{ wrapper: 'pt-0 py-6 sm:py-14' }">
429+
<div class="text-center">
430+
<UIcon name="i-ph-book-bookmark-duotone" class="h-[50px] w-[50px] text-primary" />
431+
<h2 class="text-xl xl:text-4xl font-bold mb-12 text-center">
432+
Watch the intro videos from the pros.
433+
</h2>
434+
<div class="lg:flex justify-between gap-10 items-center">
435+
<ScriptYouTubePlayer video-id="sjMqUUvH9AE" class="rounded-xl overflow-hidden group">
436+
<template #awaitingLoad>
437+
<div class="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 h-[48px] w-[68px] group-hover:opacity-80 transition">
438+
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00" /><path d="M 45,24 27,14 27,34" fill="#fff" /></svg>
439+
</div>
440+
</template>
441+
</ScriptYouTubePlayer>
442+
<ScriptYouTubePlayer video-id="jDQtxlRUf54" class="rounded-xl overflow-hidden group">
443+
<template #awaitingLoad>
444+
<div class="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 h-[48px] w-[68px] group-hover:opacity-80 transition">
445+
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00" /><path d="M 45,24 27,14 27,34" fill="#fff" /></svg>
446+
</div>
447+
</template>
448+
</ScriptYouTubePlayer>
449+
</div>
450+
</div>
451+
</ULandingSection>
452+
427453
<ULandingSection :ui="{ wrapper: 'pt-0 py-6 sm:py-14' }">
428454
<ULandingCTA
429455
description="Learn all of the fundamentals of Nuxt Scripts in the fun interactive confetti tutorial."

docs/pages/learn.vue

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<script setup lang="ts">
2+
useSeoMeta({
3+
title: 'Learn Nuxt Scripts',
4+
description: 'Follow along with the Nuxt Scripts intro videos for a fun and interactive way to learn how to use Nuxt Scripts.',
5+
})
6+
7+
defineOgImageComponent('Home')
8+
</script>
9+
10+
<template>
11+
<div>
12+
<ULandingSection :ui="{ wrapper: 'pt-0 py-6 sm:py-14' }">
13+
<div class="text-center">
14+
<UIcon name="i-ph-book-bookmark-duotone" class="h-[50px] w-[50px] text-primary"/>
15+
<h2 class="text-xl xl:text-4xl font-bold mb-12 text-center">
16+
Watch the intro videos from the pros.
17+
</h2>
18+
<div class="lg:flex justify-between gap-10 items-center">
19+
<ScriptYouTubePlayer video-id="sjMqUUvH9AE" class="rounded-xl overflow-hidden group">
20+
<template #awaitingLoad>
21+
<div class="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 h-[48px] w-[68px] group-hover:opacity-80 transition">
22+
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00" /><path d="M 45,24 27,14 27,34" fill="#fff" /></svg>
23+
</div>
24+
</template>
25+
</ScriptYouTubePlayer>
26+
<ScriptYouTubePlayer video-id="jDQtxlRUf54" class="rounded-xl overflow-hidden group">
27+
<template #awaitingLoad>
28+
<div class="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 h-[48px] w-[68px] group-hover:opacity-80 transition">
29+
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00" /><path d="M 45,24 27,14 27,34" fill="#fff" /></svg>
30+
</div>
31+
</template>
32+
</ScriptYouTubePlayer>
33+
</div>
34+
</div>
35+
</ULandingSection>
36+
37+
<ULandingSection :ui="{ wrapper: 'pt-0 py-6 sm:py-14' }">
38+
<ULandingCTA
39+
description="Learn all of the fundamentals of Nuxt Scripts in the fun interactive confetti tutorial."
40+
card
41+
>
42+
<template #title>
43+
Try out our JS Confetti Tutorial
44+
</template>
45+
<template #links>
46+
<div ref="confettiEl">
47+
<UButton size="xl" variant="solid" icon="i-ph-sparkle-duotone" color="primary" to="/docs/getting-started/confetti-tutorial">
48+
Get started
49+
</UButton>
50+
</div>
51+
</template>
52+
</ULandingCTA>
53+
</ULandingSection>
54+
</div>
55+
</template>

0 commit comments

Comments
 (0)