mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 18:30:35 +01:00
docs(app): update error
This commit is contained in:
@@ -75,14 +75,6 @@ useServerSeoMeta({
|
|||||||
|
|
||||||
const { framework, frameworks } = useSharedData()
|
const { framework, frameworks } = useSharedData()
|
||||||
|
|
||||||
const groups = computed(() => {
|
|
||||||
return [{
|
|
||||||
id: 'framework',
|
|
||||||
label: 'Framework',
|
|
||||||
items: frameworks.value
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
|
|
||||||
function filterFrameworkItems(items: any[]) {
|
function filterFrameworkItems(items: any[]) {
|
||||||
return items?.filter(item => !item.framework || item.framework === framework.value)
|
return items?.filter(item => !item.framework || item.framework === framework.value)
|
||||||
}
|
}
|
||||||
@@ -131,7 +123,11 @@ provide('navigation', filteredNavigation)
|
|||||||
<LazyUContentSearch
|
<LazyUContentSearch
|
||||||
v-model:search-term="searchTerm"
|
v-model:search-term="searchTerm"
|
||||||
:files="files"
|
:files="files"
|
||||||
:groups="groups"
|
:groups="[{
|
||||||
|
id: 'framework',
|
||||||
|
label: 'Framework',
|
||||||
|
items: frameworks
|
||||||
|
}]"
|
||||||
:navigation="filteredNavigation"
|
:navigation="filteredNavigation"
|
||||||
:fuse="{ resultLimit: 42 }"
|
:fuse="{ resultLimit: 42 }"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import colors from 'tailwindcss/colors'
|
import colors from 'tailwindcss/colors'
|
||||||
|
// import { debounce } from 'perfect-debounce'
|
||||||
import type { NuxtError } from '#app'
|
import type { NuxtError } from '#app'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,7 +12,19 @@ const appConfig = useAppConfig()
|
|||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content'))
|
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content'))
|
||||||
const { data: files } = await useAsyncData('files', () => queryCollectionSearchSections('content', { ignoredTags: ['style'] }))
|
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('content'), {
|
||||||
|
server: false
|
||||||
|
})
|
||||||
|
|
||||||
|
const searchTerm = ref('')
|
||||||
|
|
||||||
|
// watch(searchTerm, debounce((query: string) => {
|
||||||
|
// if (!query) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// useTrackEvent('Search', { props: { query: `${query} - ${searchTerm.value?.commandPaletteRef.results.length} results` } })
|
||||||
|
// }, 500))
|
||||||
|
|
||||||
const links = computed(() => [{
|
const links = computed(() => [{
|
||||||
label: 'Docs',
|
label: 'Docs',
|
||||||
@@ -68,7 +81,33 @@ useServerSeoMeta({
|
|||||||
twitterCard: 'summary_large_image'
|
twitterCard: 'summary_large_image'
|
||||||
})
|
})
|
||||||
|
|
||||||
provide('navigation', navigation)
|
const { framework, frameworks } = useSharedData()
|
||||||
|
|
||||||
|
function filterFrameworkItems(items: any[]) {
|
||||||
|
return items?.filter(item => !item.framework || item.framework === framework.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function processNavigationItem(item: any): any {
|
||||||
|
if (item.shadow) {
|
||||||
|
const matchingChild = filterFrameworkItems(item.children)?.[0]
|
||||||
|
return matchingChild
|
||||||
|
? {
|
||||||
|
...matchingChild,
|
||||||
|
title: item.title,
|
||||||
|
children: matchingChild.children ? processNavigationItem(matchingChild) : undefined
|
||||||
|
}
|
||||||
|
: item
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
children: item.children?.length ? filterFrameworkItems(item.children)?.map(processNavigationItem) : undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const filteredNavigation = computed(() => navigation.value?.map(processNavigationItem))
|
||||||
|
|
||||||
|
provide('navigation', filteredNavigation)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -84,7 +123,17 @@ provide('navigation', navigation)
|
|||||||
<Footer />
|
<Footer />
|
||||||
|
|
||||||
<ClientOnly>
|
<ClientOnly>
|
||||||
<LazyUContentSearch :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
|
<LazyUContentSearch
|
||||||
|
v-model:search-term="searchTerm"
|
||||||
|
:files="files"
|
||||||
|
:groups="[{
|
||||||
|
id: 'framework',
|
||||||
|
label: 'Framework',
|
||||||
|
items: frameworks
|
||||||
|
}]"
|
||||||
|
:navigation="filteredNavigation"
|
||||||
|
:fuse="{ resultLimit: 42 }"
|
||||||
|
/>
|
||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
</UApp>
|
</UApp>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user