From c98538e56faadea2fab9bf8177955efb037f90b1 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 13 Jan 2022 14:27:48 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E5=B0=81=E8=A3=85Card=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BlogPostCard.js | 7 ++++-- components/Card.js | 9 +++++++ components/CategoryGroup.js | 2 +- components/Collapse.js | 2 +- components/LatestPostsGroup.js | 10 ++++---- components/MenuButtonGroup.js | 2 +- components/SideAreaLeft.js | 10 ++++---- components/SideAreaRight.js | 45 +++++++++++++++++----------------- components/Tabs.js | 8 +++--- components/TopNav.js | 2 +- pages/article/[slug].js | 5 ++++ pages/index.js | 3 ++- 12 files changed, 62 insertions(+), 43 deletions(-) create mode 100644 components/Card.js diff --git a/components/BlogPostCard.js b/components/BlogPostCard.js index cbd81044..9ef97a0b 100644 --- a/components/BlogPostCard.js +++ b/components/BlogPostCard.js @@ -6,14 +6,15 @@ import Image from 'next/image' import Link from 'next/link' import React from 'react' import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x' +import Card from './Card' import TagItemMini from './TagItemMini' const BlogPostCard = ({ post, showSummary }) => { const { locale } = useGlobal() const showPreview = BLOG.home?.showPreview && post.blockMap return ( -
+ +
@@ -74,6 +75,8 @@ const BlogPostCard = ({ post, showSummary }) => { )}
+ + ) } diff --git a/components/Card.js b/components/Card.js new file mode 100644 index 00000000..bd7683b8 --- /dev/null +++ b/components/Card.js @@ -0,0 +1,9 @@ +const Card = ({ children, headerSlot, className }) => { + return
+ <>{headerSlot} +
+ {children} +
+
+} +export default Card diff --git a/components/CategoryGroup.js b/components/CategoryGroup.js index 7b521616..e768757f 100644 --- a/components/CategoryGroup.js +++ b/components/CategoryGroup.js @@ -12,7 +12,7 @@ const CategoryGroup = ({ currentCategory, categories }) => { + ' text-sm w-full items-center duration-300 px-2 cursor-pointer py-1 font-light'}> {category}({categories[category]}) diff --git a/components/Collapse.js b/components/Collapse.js index baca44cc..2b68ad73 100644 --- a/components/Collapse.js +++ b/components/Collapse.js @@ -28,7 +28,7 @@ const Collapse = props => { } }, [props.isOpen]) return ( -
+
{props.children}
) diff --git a/components/LatestPostsGroup.js b/components/LatestPostsGroup.js index 76c20c62..135027ad 100644 --- a/components/LatestPostsGroup.js +++ b/components/LatestPostsGroup.js @@ -19,16 +19,16 @@ const LatestPostsGroup = ({ posts }) => { const currentPath = useRouter().asPath const { locale } = useGlobal() - return
-
+ return <> +
{locale.COMMON.LATEST_POSTS}
{posts.map(post => { const selected = currentPath === `${BLOG.path}/article/${post.slug}` return ( - -
+
{post.title}
@@ -37,6 +37,6 @@ const LatestPostsGroup = ({ posts }) => { ) })} -
+ } export default LatestPostsGroup diff --git a/components/MenuButtonGroup.js b/components/MenuButtonGroup.js index 50d4d817..aef72bc5 100644 --- a/components/MenuButtonGroup.js +++ b/components/MenuButtonGroup.js @@ -23,7 +23,7 @@ const MenuButtonGroup = ({ allowCollapse = false, postCount }) => { if (link.show) { const selected = (router.pathname === link.to) || (router.asPath === link.to) return -
diff --git a/components/SideAreaLeft.js b/components/SideAreaLeft.js index 51c1bb81..7e406901 100644 --- a/components/SideAreaLeft.js +++ b/components/SideAreaLeft.js @@ -8,6 +8,7 @@ import Analytics from './Analytics' import Tabs from '@/components/Tabs' import BLOG from '@/blog.config' import Logo from './Logo' +import Card from './Card' /** * 侧边平铺 @@ -30,17 +31,16 @@ const SideAreaLeft = ({ title, tags, currentTag, post, postCount, categories, cu {/* 菜单 */}
-
+
- {BLOG.menu.showSearch &&
+ {BLOG.menu.showSearch &&
}
- -
+ {showToc && (
@@ -53,7 +53,7 @@ const SideAreaLeft = ({ title, tags, currentTag, post, postCount, categories, cu
-
+ } diff --git a/components/SideAreaRight.js b/components/SideAreaRight.js index 87aa39e8..fb76fb09 100644 --- a/components/SideAreaRight.js +++ b/components/SideAreaRight.js @@ -1,9 +1,10 @@ import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' -import { faAngleDoubleRight, faAngleRight, faTags, faThList } from '@fortawesome/free-solid-svg-icons' +import { faAngleDoubleRight, faAngleRight, faTag, faThList } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Link from 'next/link' import React from 'react' +import Card from './Card' import CategoryGroup from './CategoryGroup' import TagGroups from './TagGroups' @@ -38,25 +39,25 @@ const SideAreaRight = ({ return (