From edf934efbb6ebd32f536a81c410b1dd90c4b0204 Mon Sep 17 00:00:00 2001 From: boojack Date: Fri, 21 Apr 2023 14:46:41 +0800 Subject: [PATCH] chore: update memo style (#1581) --- web/src/components/Memo.tsx | 46 +++++++++++------------------- web/src/components/kit/Divider.tsx | 9 ++++++ web/src/less/memo.less | 22 +------------- web/src/locales/zh-Hans.json | 4 +-- 4 files changed, 29 insertions(+), 52 deletions(-) create mode 100644 web/src/components/kit/Divider.tsx diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx index f23fa572..395615d9 100644 --- a/web/src/components/Memo.tsx +++ b/web/src/components/Memo.tsx @@ -2,9 +2,10 @@ import { getRelativeTimeString } from "@/helpers/datetime"; import { memo, useEffect, useRef, useState } from "react"; import { toast } from "react-hot-toast"; import { useTranslation } from "react-i18next"; -import { Link, useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import { useEditorStore, useFilterStore, useMemoStore, useUserStore } from "@/store/module"; import Tooltip from "./kit/Tooltip"; +import Divider from "./kit/Divider"; import { showCommonDialog } from "./Dialog/CommonDialog"; import Icon from "./Icon"; import MemoContent from "./MemoContent"; @@ -22,7 +23,6 @@ interface Props { const Memo: React.FC = (props: Props) => { const { memo, readonly } = props; const { t, i18n } = useTranslation(); - const navigate = useNavigate(); const editorStore = useEditorStore(); const filterStore = useFilterStore(); const userStore = useUserStore(); @@ -44,10 +44,6 @@ const Memo: React.FC = (props: Props) => { }; }, [i18n.language]); - const handleViewMemoDetailPage = () => { - navigate(`/m/${memo.id}`); - }; - const handleTogglePinMemoBtnClick = async () => { try { if (memo.pinned) { @@ -213,34 +209,26 @@ const Memo: React.FC = (props: Props) => {
-
-
- -
- {memo.pinned ? ( - - ) : ( - - )} -
-
- - - - - - -
- - {t("memo.view-detail")} +
+ + {memo.pinned ? : } + {memo.pinned ? t("common.unpin") : t("common.pin")} + + + {t("common.edit")} + + + + {t("common.share")} + + + {t("common.archive")} + {t("common.delete")}
diff --git a/web/src/components/kit/Divider.tsx b/web/src/components/kit/Divider.tsx new file mode 100644 index 00000000..cafbcfd7 --- /dev/null +++ b/web/src/components/kit/Divider.tsx @@ -0,0 +1,9 @@ +interface Props { + className?: string; +} + +const Divider = ({ className }: Props) => { + return
; +}; + +export default Divider; diff --git a/web/src/less/memo.less b/web/src/less/memo.less index 0ed0166a..0da21200 100644 --- a/web/src/less/memo.less +++ b/web/src/less/memo.less @@ -50,28 +50,8 @@ @apply w-auto h-auto p-1 z-1 whitespace-nowrap rounded-lg bg-white dark:bg-zinc-800; box-shadow: 0 0 8px 0 rgb(0 0 0 / 20%); - > .btns-container { - @apply w-full flex flex-row justify-around items-center border-b border-gray-100 dark:border-zinc-600 p-1 mb-1; - - > .btn { - @apply relative w-6 h-6 p-1 text-gray-600 dark:text-gray-300 cursor-pointer select-none; - - &:hover > .tip-text { - @apply block; - } - - > .icon-img { - @apply w-5 h-auto; - } - - > .tip-text { - @apply hidden absolute top-0 p-1 px-2 rounded text-xs leading-6 -mt-9 bg-black text-white shadow opacity-70; - } - } - } - > .btn { - @apply w-full text-sm leading-6 py-1 px-3 rounded justify-start cursor-pointer dark:text-gray-300; + @apply w-full text-sm leading-6 py-1 px-3 rounded justify-start cursor-pointer select-none dark:text-gray-300; &.archive-btn { @apply text-orange-600; diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json index feb96e57..b256e6b3 100644 --- a/web/src/locales/zh-Hans.json +++ b/web/src/locales/zh-Hans.json @@ -55,7 +55,7 @@ "avatar": "头像", "rename": "改名", "upload": "上传", - "visibility": "能见度", + "visibility": "可见性", "preview": "预览", "name": "姓名", "clear": "清除" @@ -326,4 +326,4 @@ "router": { "back-to-home": "回到首页" } -} \ No newline at end of file +}