mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 18:00:43 +01:00
docs(app): use UContentSearchButton component
This commit is contained in:
@@ -11,7 +11,6 @@ const { integrity, api } = runtimeConfig.public.content
|
|||||||
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { default: () => [] })
|
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { default: () => [] })
|
||||||
const { data: files } = await useLazyFetch<ContentSearchFile[]>(`${api.baseURL}/search${integrity ? '.' + integrity : ''}`, { default: () => [] })
|
const { data: files } = await useLazyFetch<ContentSearchFile[]>(`${api.baseURL}/search${integrity ? '.' + integrity : ''}`, { default: () => [] })
|
||||||
|
|
||||||
const open = ref(false)
|
|
||||||
const searchTerm = ref('')
|
const searchTerm = ref('')
|
||||||
|
|
||||||
// watch(searchTerm, debounce((query: string) => {
|
// watch(searchTerm, debounce((query: string) => {
|
||||||
@@ -55,7 +54,6 @@ useServerSeoMeta({
|
|||||||
twitterCard: 'summary_large_image'
|
twitterCard: 'summary_large_image'
|
||||||
})
|
})
|
||||||
|
|
||||||
provide('open', open)
|
|
||||||
provide('navigation', navigation)
|
provide('navigation', navigation)
|
||||||
provide('files', files)
|
provide('files', files)
|
||||||
</script>
|
</script>
|
||||||
@@ -74,6 +72,6 @@ provide('files', files)
|
|||||||
|
|
||||||
<Footer v-if="!route.path.startsWith('/examples')" />
|
<Footer v-if="!route.path.startsWith('/examples')" />
|
||||||
|
|
||||||
<LazyUContentSearch v-model:open="open" v-model:search-term="searchTerm" :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
|
<LazyUContentSearch v-model:search-term="searchTerm" :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
|
||||||
</UApp>
|
</UApp>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const props = defineProps<{
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const config = useRuntimeConfig().public
|
const config = useRuntimeConfig().public
|
||||||
|
|
||||||
const open = inject<Ref<boolean>>('open')
|
|
||||||
const navigation = inject<Ref<NavItem[]>>('navigation')
|
const navigation = inject<Ref<NavItem[]>>('navigation')
|
||||||
|
|
||||||
const items = computed(() => props.links.map(({ icon, ...link }) => link))
|
const items = computed(() => props.links.map(({ icon, ...link }) => link))
|
||||||
@@ -36,7 +35,7 @@ const items = computed(() => props.links.map(({ icon, ...link }) => link))
|
|||||||
<!-- <ColorPicker /> -->
|
<!-- <ColorPicker /> -->
|
||||||
|
|
||||||
<UTooltip text="Search" :kbds="['meta', 'K']">
|
<UTooltip text="Search" :kbds="['meta', 'K']">
|
||||||
<UButton aria-label="Search" icon="i-heroicons-magnifying-glass-20-solid" color="gray" variant="ghost" @click="open = true" />
|
<UContentSearchButton />
|
||||||
</UTooltip>
|
</UTooltip>
|
||||||
|
|
||||||
<!-- <UColorModeButton /> -->
|
<!-- <UColorModeButton /> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user