diff --git a/themes/medium/LayoutSearch.js b/themes/medium/LayoutSearch.js index 76a9ddae..0ff29b6d 100644 --- a/themes/medium/LayoutSearch.js +++ b/themes/medium/LayoutSearch.js @@ -9,15 +9,19 @@ import BLOG from '@/blog.config' import Mark from 'mark.js' import BlogPostListScroll from './components/BlogPostListScroll' import BlogPostListPage from './components/BlogPostListPage' +import { useRouter } from 'next/router' export const LayoutSearch = (props) => { const { locale } = useGlobal() const { keyword } = props + const router = useRouter() + const currentSearch = keyword || router?.query?.s + useEffect(() => { setTimeout(() => { const container = isBrowser() && document.getElementById('container') if (container && container.innerHTML) { - const re = new RegExp(keyword, 'gim') + const re = new RegExp(currentSearch, 'gim') const instance = new Mark(container) instance.markRegExp(re, { element: 'span', @@ -28,14 +32,20 @@ export const LayoutSearch = (props) => { 100) }) return +
{locale.NAV.SEARCH}
- - + + + {!currentSearch && <> + + } +
-
+ + {currentSearch &&
{BLOG.POST_LIST_STYLE === 'page' ? : } -
+
}
} diff --git a/themes/medium/LayoutSlug.js b/themes/medium/LayoutSlug.js index e0c52b84..f7fdc4d0 100644 --- a/themes/medium/LayoutSlug.js +++ b/themes/medium/LayoutSlug.js @@ -12,9 +12,7 @@ export const LayoutSlug = props => { const { locale } = useGlobal() if (!post) { - return } @@ -30,15 +28,8 @@ export const LayoutSlug = props => { ) return ( - - - {!lock && } - - {lock && } + + {!lock ? : } ) } diff --git a/themes/medium/components/ArticleDetail.js b/themes/medium/components/ArticleDetail.js index 5e6c4da5..ea129207 100644 --- a/themes/medium/components/ArticleDetail.js +++ b/themes/medium/components/ArticleDetail.js @@ -21,25 +21,24 @@ export const ArticleDetail = props => { return
{/* title */} -

{post?.title}

+

{post?.title}

{/* meta */} -
-
- {date} - | - {post.lastEditedTime} -
- - +
+
+ {date} + | + {post.lastEditedTime} +
+
{/* eslint-disable-next-line @next/next/no-img-element */} - + -
+
{BLOG.AUTHOR}