From a4235bb4bfb67bcb03ef6bb71fd09656e270d2c0 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 8 May 2024 22:31:22 +0800 Subject: [PATCH] chore: tweak tags style --- .../components/HomeSidebar/TagsSection.tsx | 26 +++++++------------ web/src/components/UserStatisticsView.tsx | 2 +- web/src/less/base-dialog.less | 2 +- web/tailwind.config.js | 1 + 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/web/src/components/HomeSidebar/TagsSection.tsx b/web/src/components/HomeSidebar/TagsSection.tsx index a06c9334..28dc4cf9 100644 --- a/web/src/components/HomeSidebar/TagsSection.tsx +++ b/web/src/components/HomeSidebar/TagsSection.tsx @@ -11,10 +11,8 @@ import showRenameTagDialog from "../RenameTagDialog"; const TagsSection = () => { const t = useTranslate(); - const filterStore = useFilterStore(); const tagStore = useTagStore(); const memoList = useMemoList(); - const filter = filterStore.state; const tagAmounts = Object.entries(tagStore.getState().tagAmounts) .sort((a, b) => a[0].localeCompare(b[0])) .sort((a, b) => b[1] - a[1]); @@ -55,9 +53,9 @@ const TagsSection = () => { {tagAmounts.length > 0 ? ( -
+
{tagAmounts.map(([tag, amount]) => ( - + ))}
) : ( @@ -73,18 +71,16 @@ const TagsSection = () => { interface TagContainerProps { tag: string; amount: number; - tagQuery?: string; } const TagContainer: React.FC = (props: TagContainerProps) => { const t = useTranslate(); const filterStore = useFilterStore(); const tagStore = useTagStore(); - const { tag, amount, tagQuery } = props; - const isActive = tagQuery === tag; + const { tag, amount } = props; const handleTagClick = () => { - if (isActive) { + if (filterStore.getState().tag === tag) { filterStore.setTagFilter(undefined); } else { filterStore.setTagFilter(tag); @@ -106,14 +102,12 @@ const TagContainer: React.FC = (props: TagContainerProps) => return (
-
- +
+
@@ -128,9 +122,9 @@ const TagContainer: React.FC = (props: TagContainerProps) => -
- {tag} - ({amount}) +
+ {tag} + {amount > 1 && ({amount})}
); diff --git a/web/src/components/UserStatisticsView.tsx b/web/src/components/UserStatisticsView.tsx index 0359e495..3253e978 100644 --- a/web/src/components/UserStatisticsView.tsx +++ b/web/src/components/UserStatisticsView.tsx @@ -57,7 +57,7 @@ const UserStatisticsView = (props: Props) => {
- + {t("common.tags")}
{tags} diff --git a/web/src/less/base-dialog.less b/web/src/less/base-dialog.less index e40e2080..b6777709 100644 --- a/web/src/less/base-dialog.less +++ b/web/src/less/base-dialog.less @@ -1,5 +1,5 @@ .dialog-wrapper { - @apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 pb-8 px-4 z-1000 overflow-x-hidden overflow-y-scroll bg-transparent transition-all hide-scrollbar bg-black bg-opacity-60; + @apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 pb-8 px-4 z-2000 overflow-x-hidden overflow-y-scroll bg-transparent transition-all hide-scrollbar bg-black bg-opacity-60; > .dialog-container { @apply max-w-full shadow flex flex-col justify-start items-start bg-white dark:bg-zinc-800 dark:text-gray-300 p-4 rounded-lg; diff --git a/web/tailwind.config.js b/web/tailwind.config.js index 4da96a00..7b900481 100644 --- a/web/tailwind.config.js +++ b/web/tailwind.config.js @@ -28,6 +28,7 @@ module.exports = { 20: "20", 100: "100", 1000: "1000", + 2000: "2000", }, gridTemplateRows: { 7: "repeat(7, minmax(0, 1fr))",