import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import LayoutBase from './LayoutBase'
export const LayoutSearch = props => {
const { keyword, posts } = props
const router = useRouter()
const currentSearch = keyword || router?.query?.s
let handleTextColor = false
useEffect(() => {
setTimeout(() => {
if (currentSearch && !handleTextColor) {
const container = document.getElementById('container')
if (container && container.innerHTML) {
const re = new RegExp(`${currentSearch}`, 'gim')
container.innerHTML = container.innerHTML.replace(
re,
`${currentSearch}`
)
handleTextColor = true
}
}
}, 100)
})
return (
Search
)
}