Skip to content

Commit ed79db4

Browse files
authored
docs: improve responsiveness (#505)
1 parent c4cb191 commit ed79db4

File tree

7 files changed

+130
-208
lines changed

7 files changed

+130
-208
lines changed

docs/app/assets/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
@import "tailwindcss";
2-
@import "@nuxt/ui-pro";
2+
@import "@nuxt/ui";

docs/app/components/Header.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script setup lang="ts">
22
import type { NavItem } from '@nuxt/contents'
33
4-
inject<NavItem[]>('navigation', [])
4+
const navigation = inject<Ref<NavItem[]>>('navigation')
55
// const { metaSymbol } = useShortcuts()
66
const { header } = useAppConfig()
7+
const route = useRoute()
78
const links = [
89
{
910
label: 'Guides',
@@ -18,6 +19,11 @@ const links = [
1819
to: '/learn',
1920
},
2021
]
22+
23+
const navItems = computed(() => {
24+
const v = route.path.startsWith('/docs') ? navigation?.value?.[0] : navigation?.value?.[1]
25+
return v?.children || []
26+
})
2127
</script>
2228

2329
<template>
@@ -47,5 +53,21 @@ const links = [
4753
/>
4854
</template>
4955
</template>
56+
57+
<template #body>
58+
<UNavigationMenu
59+
:items="links"
60+
orientation="vertical"
61+
class="-mx-2.5"
62+
/>
63+
<template v-if="route.path.startsWith('/docs/')">
64+
<UContentNavigation
65+
:key="route.path"
66+
:collapsible="false"
67+
:navigation="navItems"
68+
highlight
69+
/>
70+
</template>
71+
</template>
5072
</UHeader>
5173
</template>

docs/app/layouts/docs.vue

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@ const navItems = computed(() => {
1111
</script>
1212

1313
<template>
14-
<div class="relative mb-20">
15-
<svg viewBox="0 0 1440 181" fill="none" xmlns="http://www.w3.org/2000/svg" class="text-blue-900/20 pointer-events-none absolute w-full top-[1px] transition-all text-sky-400 flex-shrink-0 duration-[400ms] opacity-30 z-20"><mask id="path-1-inside-1_414_5526" fill="white"><path d="M0 0H1440V181H0V0Z" /></mask><path d="M0 0H1440V181H0V0Z" fill="url(#paint0_linear_414_5526)" fill-opacity="0.22" /><path d="M0 2H1440V-2H0V2Z" fill="url(#paint1_linear_414_5526)" mask="url(#path-1-inside-1_414_5526)" /><defs><linearGradient id="paint0_linear_414_5526" x1="720" y1="0" x2="720" y2="181" gradientUnits="userSpaceOnUse"><stop stop-color="currentColor" /><stop offset="1" stop-color="currentColor" stop-opacity="0" /></linearGradient><linearGradient id="paint1_linear_414_5526" x1="0" y1="90.5" x2="1440" y2="90.5" gradientUnits="userSpaceOnUse"><stop stop-color="currentColor" stop-opacity="0" /><stop offset="0.395" stop-color="currentColor" /><stop offset="1" stop-color="currentColor" stop-opacity="0" /></linearGradient></defs></svg>
16-
<div class="px-10 pt-10 pt-1">
17-
<div class="flex gap-10">
18-
<UAside class="w-[300px] pt-10">
19-
<UContentNavigation :navigation="navItems" highlight />
20-
</UAside>
21-
<div class="xl:ml-[100px] max-w-[45rem]">
22-
<slot />
23-
</div>
24-
</div>
25-
</div>
26-
</div>
14+
<UMain class="relative mb-20">
15+
<svg viewBox="0 0 1440 181" fill="none" xmlns="http://www.w3.org/2000/svg" class="pointer-events-none absolute w-full top-[1px] transition-all text-sky-400 flex-shrink-0 duration-[400ms] opacity-30 z-20"><mask id="path-1-inside-1_414_5526" fill="white"><path d="M0 0H1440V181H0V0Z" /></mask><path d="M0 0H1440V181H0V0Z" fill="url(#paint0_linear_414_5526)" fill-opacity="0.22" /><path d="M0 2H1440V-2H0V2Z" fill="url(#paint1_linear_414_5526)" mask="url(#path-1-inside-1_414_5526)" /><defs><linearGradient id="paint0_linear_414_5526" x1="720" y1="0" x2="720" y2="181" gradientUnits="userSpaceOnUse"><stop stop-color="currentColor" /><stop offset="1" stop-color="currentColor" stop-opacity="0" /></linearGradient><linearGradient id="paint1_linear_414_5526" x1="0" y1="90.5" x2="1440" y2="90.5" gradientUnits="userSpaceOnUse"><stop stop-color="currentColor" stop-opacity="0" /><stop offset="0.395" stop-color="currentColor" /><stop offset="1" stop-color="currentColor" stop-opacity="0" /></linearGradient></defs></svg>
16+
<UContainer>
17+
<UPage>
18+
<template #left>
19+
<UPageAside>
20+
<UContentNavigation
21+
:key="route.path"
22+
:collapsible="false"
23+
:navigation="navItems"
24+
highlight
25+
/>
26+
</UPageAside>
27+
</template>
28+
29+
<slot />
30+
</UPage>
31+
</UContainer>
32+
</UMain>
2733
</template>

docs/app/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ const contributors = useRuntimeConfig().public.contributors
340340
</div>
341341
</div>
342342
</div>
343-
<UButtonGroup class="mb-4 flex" :orientation="btnGroupOrientation">
343+
<UFieldGroup class="mb-4 flex" :orientation="btnGroupOrientation">
344344
<UButton :variant="webVital === 'fcp' ? 'solid' : 'soft'" :active="webVital === 'fcp'" @click="webVital = 'fcp'">
345345
First Contentful Paint
346346
</UButton>
@@ -350,7 +350,7 @@ const contributors = useRuntimeConfig().public.contributors
350350
<UButton :variant="webVital === 'si' ? 'solid' : 'soft'" :active="webVital === 'si'" @click="webVital = 'si'">
351351
Speed Index
352352
</UButton>
353-
</UButtonGroup>
353+
</UFieldGroup>
354354
<p class="text-gray-500 dark:text-gray-400">
355355
<span class="opacity-50 text-sm">*Note that PageSpeed Insights lab data is a snapshot from a particular day, which tends to be variable. We will be updating this section with aggregated results and/or field data from production usage as soon as it's available.</span>
356356
</p>

docs/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import NuxtScripts from '../src/module'
66
// https://nuxt.com/docs/api/configuration/nuxt-config
77
export default defineNuxtConfig({
88
modules: [
9-
'@nuxt/ui-pro',
9+
'@nuxt/ui',
1010
'@nuxt/fonts',
1111
'@vueuse/nuxt',
1212
NuxtScripts,

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@nuxt/fonts": "^0.11.4",
1818
"@nuxt/image": "^1.11.0",
1919
"@nuxt/scripts": "workspace:*",
20-
"@nuxt/ui-pro": "^3.3.4",
20+
"@nuxt/ui": "4.0.0-alpha.2",
2121
"@nuxthq/studio": "^2.2.1",
2222
"@nuxtjs/seo": "^3.2.2",
2323
"@vueuse/core": "^13.9.0",

0 commit comments

Comments
 (0)