diff --git a/components/DebugPanel.js b/components/DebugPanel.js index bd8a9e17..82eb4c10 100644 --- a/components/DebugPanel.js +++ b/components/DebugPanel.js @@ -29,10 +29,9 @@ export function DebugPanel() { } function handleChangeDebugTheme() { - switchTheme() - updateThemeConfig(Object.assign({}, ThemeMap[theme].THEME_CONFIG)) - updateDebugTheme(theme) - console.log('更换主题', debugTheme) + const newTheme = switchTheme() + updateThemeConfig(Object.assign({}, ThemeMap[newTheme].THEME_CONFIG)) + updateDebugTheme(newTheme) } function handleUpdateDebugTheme(e) { diff --git a/lib/global.js b/lib/global.js index 6dd44e93..158f8ac6 100644 --- a/lib/global.js +++ b/lib/global.js @@ -37,7 +37,9 @@ export function GlobalContextProvider({ children }) { function switchTheme() { const currentIndex = ALL_THEME.indexOf(theme) const newIndex = currentIndex < ALL_THEME.length - 1 ? currentIndex + 1 : 0 - changeTheme(ALL_THEME[newIndex]) + const newTheme = ALL_THEME[newIndex] + changeTheme(newTheme) + return newTheme } function changeTheme(theme) { diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index bf692fa2..fb655b33 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -236,8 +236,8 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { }) } - const categoryOptions = getAllCategories({ allPages, categoryOptions: getCategoryOptions(schema), sliceCount: BLOG.PREVIEW_CATEGORY_COUNT }) - const tagOptions = getAllTags({ allPages, sliceCount: BLOG.PREVIEW_TAG_COUNT, tagOptions: getTagOptions(schema) }) + const categoryOptions = getAllCategories({ allPages, categoryOptions: getCategoryOptions(schema) }) + const tagOptions = getAllTags({ allPages, tagOptions: getTagOptions(schema) }) const siteInfo = getBlogInfo({ collection, block }) const customNav = getCustomNav({ allPages: collectionData.filter(post => post.type === 'Page' && post.status === 'Published') }) const latestPosts = getLatestPosts({ allPages, from, latestPostCount: 5 }) diff --git a/pages/search/index.js b/pages/search/index.js index e8f51d32..fc20c5fd 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -19,7 +19,7 @@ const Search = props => { return searchContent.toLowerCase().includes(searchKey.toLowerCase()) }) } else { - filteredPosts = posts + filteredPosts = [] } const { locale } = useGlobal() diff --git a/themes/hexo/LayoutBase.js b/themes/hexo/LayoutBase.js index 59639a66..43086104 100644 --- a/themes/hexo/LayoutBase.js +++ b/themes/hexo/LayoutBase.js @@ -71,7 +71,7 @@ const LayoutBase = props => { id="container-inner" className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' pt-14 w-full mx-auto lg:flex lg:space-x-4 justify-center relative z-10'} > -
+
{onLoading ? : children}
diff --git a/themes/nobelium/LayoutSearch.js b/themes/nobelium/LayoutSearch.js index 23b10b7a..2da4772c 100644 --- a/themes/nobelium/LayoutSearch.js +++ b/themes/nobelium/LayoutSearch.js @@ -7,6 +7,7 @@ import SearchInput from './components/SearchInput' import Mark from 'mark.js' import LayoutBase from './LayoutBase' import { isBrowser } from '@/lib/utils' +import Tags from './components/Tags' export const LayoutSearch = props => { const { keyword } = props @@ -48,6 +49,7 @@ export const LayoutSearch = props => {
+ {BLOG.POST_LIST_STYLE === 'page' ? : } diff --git a/themes/nobelium/components/Tags.js b/themes/nobelium/components/Tags.js index a4517566..ae93d85a 100644 --- a/themes/nobelium/components/Tags.js +++ b/themes/nobelium/components/Tags.js @@ -1,14 +1,15 @@ import Link from 'next/link' -const Tags = (props) => { - const { tags, tag } = props +const Tags = props => { + const { tagOptions, tag } = props + console.log(props) const currentTag = tag - if (!tags) return null + if (!tagOptions) return null return (
    - {Object.keys(tags).map(key => { - const tag = tags[key] + {Object.keys(tagOptions).map(key => { + const tag = tagOptions[key] const selected = tag.name === currentTag return (