mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-03 23:16:52 +00:00
Next主题支持algolia全文搜索
This commit is contained in:
@@ -10,6 +10,7 @@ import SearchDrawer from './SearchDrawer'
|
||||
import TagGroups from './TagGroups'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { useNextGlobal } from '..'
|
||||
|
||||
let windowTop = 0
|
||||
|
||||
@@ -54,6 +55,16 @@ const TopNav = (props) => {
|
||||
changeShow(!isOpen)
|
||||
}
|
||||
|
||||
const { searchModal } = useNextGlobal()
|
||||
const showSeachModal = () => {
|
||||
if (siteConfig('ALGOLIA_APP_ID')) {
|
||||
searchModal?.current?.openSearch()
|
||||
} else {
|
||||
searchDrawer?.current?.show()
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索栏
|
||||
const searchDrawerSlot = <>
|
||||
{categories && (
|
||||
<section className='mt-8'>
|
||||
@@ -112,7 +123,7 @@ const TopNav = (props) => {
|
||||
|
||||
{/* 右侧功能 */}
|
||||
<div className='mr-1 flex justify-end items-center text-sm space-x-4 font-serif dark:text-gray-200'>
|
||||
<div className="cursor-pointer block lg:hidden" onClick={() => { searchDrawer?.current?.show() }}>
|
||||
<div className="cursor-pointer block lg:hidden" onClick={showSeachModal}>
|
||||
<i className="mr-2 fas fa-search" />{locale.NAV.SEARCH}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user