+
+
+
+
diff --git a/themes/Hexo/components/MenuButtonGroupTop.js b/themes/Hexo/components/MenuButtonGroupTop.js
index 2f1c466f..54307132 100644
--- a/themes/Hexo/components/MenuButtonGroupTop.js
+++ b/themes/Hexo/components/MenuButtonGroupTop.js
@@ -8,6 +8,7 @@ const MenuButtonGroupTop = (props) => {
const { locale } = useGlobal()
let links = [
+ { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_HEXO.MENU_SEARCH },
{ icon: 'fas fa-archive', name: locale.COMMON.ARTICLE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG }
diff --git a/themes/Hexo/components/MenuList.js b/themes/Hexo/components/MenuList.js
index 905a03fd..10439eb3 100644
--- a/themes/Hexo/components/MenuList.js
+++ b/themes/Hexo/components/MenuList.js
@@ -15,7 +15,7 @@ const MenuList = (props) => {
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: CONFIG_HEXO.MENU_ARCHIVE },
- { icon: 'fas fa-user', name: locale.NAV.ABOUT, to: '/about', show: CONFIG_HEXO.MENU_ABOUT }
+ { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_HEXO.MENU_SEARCH }
]
if (customNav) {
links = links.concat(customNav)
diff --git a/themes/Hexo/components/SearchInput.js b/themes/Hexo/components/SearchInput.js
index 31074800..438920f7 100644
--- a/themes/Hexo/components/SearchInput.js
+++ b/themes/Hexo/components/SearchInput.js
@@ -1,8 +1,9 @@
import { useRouter } from 'next/router'
import { useImperativeHandle, useRef, useState } from 'react'
+let lock = false
-const SearchInput = ({ currentTag, currentSearch, cRef }) => {
- const [searchKey, setSearchKey] = useState(currentSearch || '')
+const SearchInput = (props) => {
+ const { currentSearch, cRef, className } = props
const [onLoading, setLoadingState] = useState(false)
const router = useRouter()
const searchInputRef = useRef()
@@ -13,12 +14,12 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => {
}
}
})
- const handleSearch = (key) => {
+
+ const handleSearch = () => {
+ const key = searchInputRef.current.value
if (key && key !== '') {
setLoadingState(true)
- router.push({ pathname: '/search', query: { s: key } }).then(r => {
- setLoadingState(false)
- })
+ location.href = '/search/' + key
} else {
router.push({ pathname: '/' }).then(r => {
})
@@ -33,12 +34,19 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => {
}
const cleanSearch = () => {
searchInputRef.current.value = ''
- setSearchKey('')
}
- let lock = false
+
+ const [showClean, setShowClean] = useState(false)
const updateSearchKey = (val) => {
- if (!lock) {
- setSearchKey(val)
+ if (lock) {
+ return
+ }
+ searchInputRef.current.value = val
+
+ if (val) {
+ setShowClean(true)
+ } else {
+ setShowClean(false)
}
}
function lockSearchInput () {
@@ -48,8 +56,9 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => {
function unLockSearchInput () {
lock = false
}
- return
-
+
{
defaultValue={currentSearch}
/>
-
{ handleSearch(searchKey) }}>
+
-
+
- {(searchKey && searchKey.length &&
+ {(showClean &&
diff --git a/themes/Hexo/components/SideRight.js b/themes/Hexo/components/SideRight.js
index ad7ba329..0ff07cd6 100644
--- a/themes/Hexo/components/SideRight.js
+++ b/themes/Hexo/components/SideRight.js
@@ -17,8 +17,9 @@ export default function SideRight (props) {
showCategory,
showTag
} = props
+
return (
-
+
diff --git a/themes/Hexo/components/TopNav.js b/themes/Hexo/components/TopNav.js
index a9ad8aad..464277c5 100644
--- a/themes/Hexo/components/TopNav.js
+++ b/themes/Hexo/components/TopNav.js
@@ -107,7 +107,7 @@ const TopNav = (props) => {
-
+
diff --git a/themes/index.js b/themes/index.js
index e9b63872..5acc65dd 100644
--- a/themes/index.js
+++ b/themes/index.js
@@ -3,7 +3,7 @@
*/
// export * from './Empty' // 空主题
-export * from './NEXT'
+// export * from './NEXT'
// export * from './Fukasawa'
-// export * from './Hexo'
+export * from './Hexo'
// export * from './Medium'