mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
fukasawa 搜索调整
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
import LayoutBase from './LayoutBase'
|
||||
import BlogListPage from './components/BlogListPage'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export const LayoutSearch = (props) => {
|
||||
return <LayoutBase {...props}>
|
||||
const { keyword } = props
|
||||
const router = useRouter()
|
||||
const currentSearch = keyword || router?.query?.s
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
const container = document.getElementById('container')
|
||||
if (container && container.innerHTML) {
|
||||
const re = new RegExp(`${currentSearch}`, 'gim')
|
||||
container.innerHTML = container.innerHTML.replace(re, `<span class='text-red-500 border-b border-dashed'>${currentSearch}</span>`)
|
||||
}
|
||||
},
|
||||
100)
|
||||
})
|
||||
return <LayoutBase {...props} currentSearch={currentSearch}>
|
||||
<BlogListPage {...props}/>
|
||||
</LayoutBase>
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ function AsideLeft (props) {
|
||||
|
||||
<section className='flex flex-col text-gray-600'>
|
||||
<hr className='w-12 my-8' />
|
||||
<SearchInput/>
|
||||
<SearchInput {...props}/>
|
||||
</section>
|
||||
|
||||
<section className='flex flex-col'>
|
||||
|
||||
Reference in New Issue
Block a user