feat: separate search and explore (#2075)
Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>
This commit is contained in:
parent
1fbd88c826
commit
e9740fe693
4 changed files with 38 additions and 8 deletions
|
@ -40,16 +40,13 @@ const tabs = $computed<CommonRouteTabOption[]>(() => [
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<MainContent :no-overflow-hidden="isExtraLargeScreen" :back-on-small-screen="isExtraLargeScreen">
|
||||
<template v-if="!isExtraLargeScreen" #title>
|
||||
<MainContent>
|
||||
<template #title>
|
||||
<span timeline-title-style flex items-center gap-2 cursor-pointer @click="$scrollToTop">
|
||||
<div i-ri:hashtag />
|
||||
<span>{{ t('nav.explore') }}</span>
|
||||
</span>
|
||||
</template>
|
||||
<template v-else #title>
|
||||
<SearchWidget v-if="isHydrated" ref="search" class="m-1" />
|
||||
</template>
|
||||
|
||||
<template #header>
|
||||
<CommonRouteTabs replace :options="tabs" />
|
||||
|
|
33
pages/[[server]]/search.vue
Normal file
33
pages/[[server]]/search.vue
Normal file
|
@ -0,0 +1,33 @@
|
|||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
useHydratedHead({
|
||||
title: () => t('nav.search'),
|
||||
})
|
||||
|
||||
const search = $ref<{ input?: HTMLInputElement }>()
|
||||
watchEffect(() => {
|
||||
if (search?.input)
|
||||
search?.input?.focus()
|
||||
})
|
||||
onActivated(() =>
|
||||
search?.input?.focus(),
|
||||
)
|
||||
onDeactivated(() => search?.input?.blur())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<MainContent>
|
||||
<template #title>
|
||||
<NuxtLink to="/search" timeline-title-style flex items-center gap-2 @click="$scrollToTop">
|
||||
<div i-ri:search-line class="rtl-flip" />
|
||||
<span>{{ $t('nav.search') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<div px2 mt3>
|
||||
<SearchWidget v-if="isHydrated" ref="search" m-1 />
|
||||
</div>
|
||||
</MainContent>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue