diff --git a/web/src/components/ApperanceDropdownMenu.tsx b/web/src/components/ApperanceDropdownMenu.tsx deleted file mode 100644 index 5badb560b..000000000 --- a/web/src/components/ApperanceDropdownMenu.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { Option, Select } from "@mui/joy"; -import { useTranslation } from "react-i18next"; - -import Icon from "./Icon"; -import { APPERANCE_OPTIONS } from "../helpers/consts"; -import useApperance, { Apperance } from "../hooks/useApperance"; - -const ApperanceDropdownMenu = () => { - const [apperance, setApperance] = useApperance(); - const { t } = useTranslation(); - - const apperanceOptionItems = [ - [ - APPERANCE_OPTIONS[0], - <> - -

{t("setting.apperance-option.follow-system")}

- , - ], - [ - APPERANCE_OPTIONS[1], - <> - -

{t("setting.apperance-option.always-light")}

- , - ], - [ - APPERANCE_OPTIONS[2], - <> - -

{t("setting.apperance-option.always-dark")}

- , - ], - ] as const; - - return ( - - ); -}; - -export default ApperanceDropdownMenu; diff --git a/web/src/components/ApperanceSelect.tsx b/web/src/components/ApperanceSelect.tsx new file mode 100644 index 000000000..23df3ed6b --- /dev/null +++ b/web/src/components/ApperanceSelect.tsx @@ -0,0 +1,40 @@ +import { Option, Select } from "@mui/joy"; +import { useTranslation } from "react-i18next"; +import Icon from "./Icon"; +import { APPERANCE_OPTIONS } from "../helpers/consts"; +import useApperance, { Apperance } from "../hooks/useApperance"; + +const ApperanceSelect = () => { + const [apperance, setApperance] = useApperance(); + const { t } = useTranslation(); + + const getPrefixIcon = (apperance: Apperance) => { + const className = "w-4 h-auto"; + if (apperance === "light") { + return ; + } else if (apperance === "dark") { + return ; + } else { + return ; + } + }; + + return ( + + ); +}; + +export default ApperanceSelect; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index b78be1b80..4dbf1052e 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -162,9 +162,9 @@ "additional-script-placeholder": "Additional JavaScript codes" }, "apperance-option": { - "follow-system": "Follow system", - "always-light": "Always light", - "always-dark": "Always dark" + "auto": "Follow system", + "light": "Always light", + "dark": "Always dark" } }, "amount-text": { diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 14feab8df..a8e468ef4 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -162,9 +162,9 @@ "additional-script-placeholder": "自定义 JavaScript 代码" }, "apperance-option": { - "follow-system": "跟随系统", - "always-light": "总是浅色", - "always-dark": "总是深色" + "auto": "跟随系统", + "light": "总是浅色", + "dark": "总是深色" } }, "amount-text": { diff --git a/web/src/pages/Auth.tsx b/web/src/pages/Auth.tsx index 02da8c85c..df6019a2b 100644 --- a/web/src/pages/Auth.tsx +++ b/web/src/pages/Auth.tsx @@ -9,7 +9,7 @@ import useLoading from "../hooks/useLoading"; import { globalService, userService } from "../services"; import Icon from "../components/Icon"; import toastHelper from "../components/Toast"; -import ApperanceDropdownMenu from "../components/ApperanceDropdownMenu"; +import ApperanceSelect from "../components/ApperanceSelect"; import "../less/auth.less"; const validateConfig: ValidatorConfig = { @@ -164,17 +164,17 @@ const Auth = () => {
- +