|
1 | 1 | <script setup lang="ts"> |
2 | | -import type { ParsedContent } from '@nuxt/content/dist/runtime/types' |
3 | | -import type { PageLink } from '#ui-pro/types' |
| 2 | +import { mapContentNavigation } from '@nuxt/ui-pro/runtime/utils/content.js' |
| 3 | +import type { ContentNavigationItem } from '@nuxt/content' |
| 4 | +
|
| 5 | +const appConfig = useAppConfig() |
| 6 | +const radius = computed( |
| 7 | + () => `:root { --ui-radius: ${appConfig.theme.radius}rem; }`, |
| 8 | +) |
4 | 9 |
|
5 | | -// Seo |
6 | | -const { seo } = useAppConfig() |
7 | 10 | useHead({ |
8 | 11 | htmlAttrs: { lang: 'en' }, |
| 12 | + meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1' }], |
9 | 13 | link: [{ rel: 'icon', href: '/favicon.ico' }], |
| 14 | + style: [{ innerHTML: radius, id: 'nuxt-ui-radius', tagPriority: -2 }], |
10 | 15 | }) |
| 16 | +
|
11 | 17 | useSeoMeta({ |
12 | | - titleTemplate: `%s - ${seo.siteName}`, |
13 | | - ogSiteName: seo.siteName, |
| 18 | + titleTemplate: `%s - ${appConfig.seo.siteName}`, |
| 19 | + ogSiteName: appConfig.seo.siteName, |
14 | 20 | twitterCard: 'summary_large_image', |
15 | 21 | }) |
16 | 22 |
|
17 | 23 | // Navigation Data |
18 | 24 | const { data: navigation } = await useAsyncData('navigation', () => |
19 | | - fetchContentNavigation()) |
20 | | -provide('navigation', navigation) |
| 25 | + queryCollectionNavigation('docs')) |
| 26 | +
|
| 27 | +const nav = computed<ContentNavigationItem[]>(() => |
| 28 | + mapContentNavigation(navigation.value), |
| 29 | +) |
| 30 | +provide('navigation', nav) |
21 | 31 |
|
22 | 32 | // Search |
23 | | -const { data: files } = useLazyFetch<ParsedContent[]>('/api/search.json', { |
24 | | - default: () => [], |
25 | | - server: false, |
26 | | -}) |
| 33 | +const { data: files } = useAsyncData( |
| 34 | + '/api/search.json', |
| 35 | + () => queryCollectionSearchSections('docs'), |
| 36 | + { server: false }, |
| 37 | +) |
27 | 38 |
|
28 | | -// Header |
| 39 | +// // Header |
29 | 40 | const route = useRoute() |
30 | | -const links: PageLink[] = computed(() => [ |
| 41 | +const links = computed<unknown[]>(() => [ |
31 | 42 | { |
32 | 43 | label: 'Getting started', |
33 | 44 | to: `/getting-started`, |
34 | 45 | icon: 'i-heroicons-rocket-launch', |
35 | | - active: route.path.startsWith('/getting-started'), |
36 | 46 | }, |
37 | 47 | { |
38 | 48 | label: 'Features', |
39 | | - to: `/features/presets`, |
40 | | - icon: 'i-heroicons-rocket-launch', |
41 | | - active: route.path.startsWith('/features'), |
| 49 | + to: '/features', |
| 50 | + icon: 'i-heroicons-book-open', |
42 | 51 | }, |
43 | 52 | { |
44 | | - label: 'Api', |
45 | | - to: `/api/use-motion`, |
46 | | - icon: 'i-heroicons-rocket-launch', |
47 | | - active: route.path.startsWith('/api'), |
| 53 | + label: 'API', |
| 54 | + to: '/api', |
| 55 | + icon: 'i-heroicons-code-bracket', |
48 | 56 | }, |
49 | 57 | ]) |
50 | 58 | </script> |
51 | 59 |
|
52 | 60 | <template> |
53 | | - <div> |
54 | | - <TheHeader :links="links" /> |
| 61 | + <UApp> |
| 62 | + <NuxtLoadingIndicator /> |
| 63 | + <Header :links="links" /> |
55 | 64 |
|
56 | 65 | <NuxtLayout> |
57 | 66 | <NuxtPage /> |
58 | 67 | </NuxtLayout> |
59 | 68 |
|
60 | | - <TheFooter /> |
| 69 | + <Footer /> |
61 | 70 |
|
62 | 71 | <ClientOnly> |
63 | 72 | <LazyUContentSearch |
64 | 73 | :files="files" |
65 | | - :navigation="navigation ?? undefined" |
66 | | - :links="links" |
| 74 | + :navigation="navigation" |
| 75 | + :multiple="true" |
| 76 | + :kbds="['meta', 'K']" |
67 | 77 | /> |
68 | 78 | </ClientOnly> |
69 | | - |
70 | | - <UNotifications /> |
71 | | - </div> |
| 79 | + </UApp> |
72 | 80 | </template> |
73 | 81 |
|
74 | | -<style> |
75 | | -body { |
76 | | - font-family: 'Inter var experimental', 'Inter var', 'Inter', sans-serif; |
77 | | -} |
78 | | -</style> |
| 82 | +<style></style> |
0 commit comments