From ad912e62b1e48b2cebcde5e43493d2538e24619e Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 8 Feb 2023 15:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2=E9=A1=B5?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=A0=87=E7=AD=BE=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/index.js | 2 ++ themes/fukasawa/components/GroupCategory.js | 4 ++-- themes/hexo/LayoutSearch.js | 6 +++--- themes/matery/LayoutSearch.js | 6 +++--- themes/medium/components/CategoryGroup.js | 6 +++--- themes/medium/components/TagGroups.js | 6 +++--- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pages/search/index.js b/pages/search/index.js index e8f51d32..e5eebdbb 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -36,6 +36,8 @@ const Search = props => { const { theme } = useGlobal() const ThemeComponents = ThemeMap[theme] + console.log('search', props) + return ( {category.name}({category.count}) - ); + ) })} - ; + } export default GroupCategory diff --git a/themes/hexo/LayoutSearch.js b/themes/hexo/LayoutSearch.js index bb7225ca..ae1e938a 100644 --- a/themes/hexo/LayoutSearch.js +++ b/themes/hexo/LayoutSearch.js @@ -12,7 +12,7 @@ import Card from './components/Card' import Link from 'next/link' export const LayoutSearch = props => { - const { keyword, tags, categories } = props + const { keyword, tagOptions, categoryOptions } = props const { locale } = useGlobal() const router = useRouter() const currentSearch = keyword || router?.query?.s @@ -49,7 +49,7 @@ export const LayoutSearch = props => { {locale.COMMON.CATEGORY}:
- {categories?.map(category => { + {categoryOptions?.map(category => { return ( { {locale.COMMON.TAGS}:
- {tags?.map(tag => { + {tagOptions?.map(tag => { return (
diff --git a/themes/matery/LayoutSearch.js b/themes/matery/LayoutSearch.js index a64f1f2d..94ccbb96 100644 --- a/themes/matery/LayoutSearch.js +++ b/themes/matery/LayoutSearch.js @@ -12,7 +12,7 @@ import Card from './components/Card' import Link from 'next/link' export const LayoutSearch = props => { - const { keyword, tags, categories } = props + const { keyword, tagOptions, categoryOptions } = props const { locale } = useGlobal() const router = useRouter() const currentSearch = keyword || router?.query?.s @@ -49,7 +49,7 @@ export const LayoutSearch = props => { {locale.COMMON.CATEGORY}:
- {categories?.map(category => { + {categoryOptions?.map(category => { return ( { {locale.COMMON.TAGS}:
- {tags?.map(tag => { + {tagOptions?.map(tag => { return (
diff --git a/themes/medium/components/CategoryGroup.js b/themes/medium/components/CategoryGroup.js index 12b41e0f..1516c038 100644 --- a/themes/medium/components/CategoryGroup.js +++ b/themes/medium/components/CategoryGroup.js @@ -1,14 +1,14 @@ import React from 'react' import CategoryItem from './CategoryItem' -const CategoryGroup = ({ currentCategory, categories }) => { - if (!categories) { +const CategoryGroup = ({ currentCategory, categoryOptions }) => { + if (!categoryOptions) { return <> } return
分类
- {categories?.map(category => { + {categoryOptions?.map(category => { const selected = currentCategory === category.name return })} diff --git a/themes/medium/components/TagGroups.js b/themes/medium/components/TagGroups.js index 9168fa20..390a6306 100644 --- a/themes/medium/components/TagGroups.js +++ b/themes/medium/components/TagGroups.js @@ -7,14 +7,14 @@ import TagItemMini from './TagItemMini' * @returns {JSX.Element} * @constructor */ -const TagGroups = ({ tags, currentTag }) => { - if (!tags) return <> +const TagGroups = ({ tagOptions, currentTag }) => { + if (!tagOptions) return <> return (
标签
{ - tags?.map(tag => { + tagOptions?.map(tag => { const selected = tag.name === currentTag return })