From a23810fa59d9f5dce43653cf0bf89c95ed71a258 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 13 Apr 2022 14:54:58 +0800 Subject: [PATCH] build --- themes/example/LayoutSearch.js | 2 +- themes/fukasawa/LayoutSearch.js | 5 ++--- themes/fukasawa/components/BlogListPage.js | 4 ++-- themes/hexo/LayoutSearch.js | 6 +++--- themes/medium/components/BlogPostListScroll.js | 8 ++++---- themes/medium/components/CategoryGroup.js | 4 ++-- themes/medium/components/TagGroups.js | 12 ++++++------ 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/themes/example/LayoutSearch.js b/themes/example/LayoutSearch.js index d24024a5..110c11a6 100644 --- a/themes/example/LayoutSearch.js +++ b/themes/example/LayoutSearch.js @@ -38,7 +38,7 @@ export const LayoutSearch = props => {

Search - {keyword}

- {postsToShow.map(p => ( + {postsToShow?.map(p => (
{p.title} diff --git a/themes/fukasawa/LayoutSearch.js b/themes/fukasawa/LayoutSearch.js index 727e9595..46d01031 100644 --- a/themes/fukasawa/LayoutSearch.js +++ b/themes/fukasawa/LayoutSearch.js @@ -14,10 +14,9 @@ export const LayoutSearch = (props) => { const re = new RegExp(`${currentSearch}`, 'gim') container.innerHTML = container.innerHTML.replace(re, `${currentSearch}`) } - }, - 100) + }, 100) }) return - + } diff --git a/themes/fukasawa/components/BlogListPage.js b/themes/fukasawa/components/BlogListPage.js index 51c1c6c1..a418ff47 100644 --- a/themes/fukasawa/components/BlogListPage.js +++ b/themes/fukasawa/components/BlogListPage.js @@ -17,7 +17,7 @@ const BlogListPage = ({ page = 1, posts = [], postCount }) => { const showNext = page < totalPage && posts.length === BLOG.POSTS_PER_PAGE && posts.length < postCount const [colCount, changeCol] = useState(1) - function updateCol () { + function updateCol() { if (window.outerWidth > 1200) { changeCol(3) } else { @@ -40,7 +40,7 @@ const BlogListPage = ({ page = 1, posts = [], postCount }) => {
{/* 文章列表 */}
- {posts.map(post => ( + {posts?.map(post => (
diff --git a/themes/hexo/LayoutSearch.js b/themes/hexo/LayoutSearch.js index 9b0803ec..6152a282 100644 --- a/themes/hexo/LayoutSearch.js +++ b/themes/hexo/LayoutSearch.js @@ -27,7 +27,7 @@ export const LayoutSearch = props => { const re = new RegExp(`${currentSearch}`, 'gim') container.innerHTML = container.innerHTML.replace( re, - `${currentSearch}` + `${currentSearch}` ) handleTextColor = true } @@ -46,7 +46,7 @@ export const LayoutSearch = props => { {locale.COMMON.CATEGORY}:
- {categories.map(category => { + {categories?.map(category => { return ( { {locale.COMMON.TAGS}:
- {tags.map(tag => { + {tags?.map(tag => { return (
diff --git a/themes/medium/components/BlogPostListScroll.js b/themes/medium/components/BlogPostListScroll.js index 1b2334cc..3b2003df 100644 --- a/themes/medium/components/BlogPostListScroll.js +++ b/themes/medium/components/BlogPostListScroll.js @@ -65,8 +65,8 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => { {/* 文章列表 */}
- {postsToShow.map(post => ( - + {postsToShow?.map(post => ( + ))}
@@ -74,7 +74,7 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => {
{ handleGetMore() }} - className='w-full my-4 py-4 text-center cursor-pointer glassmorphism shadow-xl rounded-xl dark:text-gray-200' + className='w-full my-4 py-4 text-center cursor-pointer glassmorphism shadow-xl rounded-xl dark:text-gray-200' > {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}
@@ -95,7 +95,7 @@ const getPostByPage = function (page, totalPosts, postsPerPage) { ) } -function getSearchKey () { +function getSearchKey() { const router = useRouter() if (router.query && router.query.s) { return router.query.s diff --git a/themes/medium/components/CategoryGroup.js b/themes/medium/components/CategoryGroup.js index 797e3afa..12b41e0f 100644 --- a/themes/medium/components/CategoryGroup.js +++ b/themes/medium/components/CategoryGroup.js @@ -8,9 +8,9 @@ const CategoryGroup = ({ currentCategory, categories }) => { return
分类
- {categories.map(category => { + {categories?.map(category => { const selected = currentCategory === category.name - return + return })}
diff --git a/themes/medium/components/TagGroups.js b/themes/medium/components/TagGroups.js index dd2a2643..9168fa20 100644 --- a/themes/medium/components/TagGroups.js +++ b/themes/medium/components/TagGroups.js @@ -13,12 +13,12 @@ const TagGroups = ({ tags, currentTag }) => {
标签
- { - tags.map(tag => { - const selected = tag.name === currentTag - return - }) - } + { + tags?.map(tag => { + const selected = tag.name === currentTag + return + }) + }
)