From f4dc88e982b59b385c84c60a91ec42a6914bf575 Mon Sep 17 00:00:00 2001 From: saicaca Date: Wed, 11 Oct 2023 22:29:23 +0800 Subject: [PATCH] feat: allow collapsing widget content, add categories widget (cherry picked from commit 9a4ca8f6163d5e1375aa7c612e1338cce5a8c0b5) --- src/components/ArchivePanel.astro | 3 +- src/components/Navbar.astro | 6 +-- src/components/widget/Categories.astro | 33 ++++++++++++ src/components/widget/CategoriesLink.astro | 21 ++++++++ src/components/widget/RecentPost.astro | 6 +-- src/components/widget/SideBar.astro | 16 ++++-- .../widget/{Tag.astro => Tags.astro} | 6 ++- src/components/widget/WidgetLayout.astro | 52 +++++++++++++++++-- src/i18n/i18nKey.ts | 2 + src/i18n/languages/en.ts | 2 + src/i18n/languages/zh_CN.ts | 2 + src/i18n/languages/zh_TW.ts | 2 + src/pages/page/[page].astro | 11 +--- src/pages/posts/[slug].astro | 2 +- src/utils/content-utils.ts | 30 ++++++++--- src/utils/url-utils.ts | 13 +++++ 16 files changed, 174 insertions(+), 33 deletions(-) create mode 100644 src/components/widget/Categories.astro create mode 100644 src/components/widget/CategoriesLink.astro rename src/components/widget/{Tag.astro => Tags.astro} (70%) diff --git a/src/components/ArchivePanel.astro b/src/components/ArchivePanel.astro index 33907f5..eeab882 100644 --- a/src/components/ArchivePanel.astro +++ b/src/components/ArchivePanel.astro @@ -7,7 +7,8 @@ interface Props { const { keyword, tags, categories} = Astro.props; import Button from "./control/Button.astro"; -import {getPostUrlBySlug, getSortedPosts} from "../utils/content-utils"; +import {getSortedPosts} from "../utils/content-utils"; +import {getPostUrlBySlug} from "../utils/url-utils"; let posts = await getSortedPosts() diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 18e69f4..93ccd45 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -19,10 +19,10 @@ function getLinkName(name: string) { } --- -
-