From 55f37664ef22d3e791b4b6cb84e72581fd6b8f26 Mon Sep 17 00:00:00 2001 From: boojack Date: Tue, 29 Nov 2022 20:15:16 +0800 Subject: [PATCH] chore: add theme file for joyui (#635) --- web/src/App.tsx | 3 ++- web/src/components/ApperanceSelect.tsx | 2 +- web/src/components/SearchBar.tsx | 2 +- web/src/components/UserBanner.tsx | 1 - web/src/less/search-bar.less | 6 +----- web/src/pages/Auth.tsx | 6 +++++- web/src/theme/index.ts | 15 +++++++++++++++ 7 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 web/src/theme/index.ts diff --git a/web/src/App.tsx b/web/src/App.tsx index 4900de74..2fd8a98e 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -6,6 +6,7 @@ import { locationService } from "./services"; import { useAppSelector } from "./store"; import router from "./router"; import * as storage from "./helpers/storage"; +import theme from "./theme"; function App() { const { i18n } = useTranslation(); @@ -41,7 +42,7 @@ function App() { }, [locale]); return ( - + ); diff --git a/web/src/components/ApperanceSelect.tsx b/web/src/components/ApperanceSelect.tsx index 23df3ed6..15d7dfd2 100644 --- a/web/src/components/ApperanceSelect.tsx +++ b/web/src/components/ApperanceSelect.tsx @@ -21,7 +21,7 @@ const ApperanceSelect = () => { return ( +
diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 833a9548..71e859ad 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -63,7 +63,6 @@ const UserBanner = () => { }; const handleSignOutBtnClick = async () => { - userService.doSignOut().catch(); navigate("/auth"); }; diff --git a/web/src/less/search-bar.less b/web/src/less/search-bar.less index bdbdedf9..0fd0ac6d 100644 --- a/web/src/less/search-bar.less +++ b/web/src/less/search-bar.less @@ -3,10 +3,6 @@ &:hover, &:active { - > .search-bar-inputer > .text-input { - @apply flex; - } - > .quickly-action-wrapper { @apply flex; } @@ -20,7 +16,7 @@ } > .text-input { - @apply hidden sm:flex ml-2 w-24 grow text-sm outline-none bg-transparent; + @apply flex ml-2 w-24 grow text-sm outline-none bg-transparent; } } diff --git a/web/src/pages/Auth.tsx b/web/src/pages/Auth.tsx index df6019a2..9661873e 100644 --- a/web/src/pages/Auth.tsx +++ b/web/src/pages/Auth.tsx @@ -1,5 +1,5 @@ import { Option, Select } from "@mui/joy"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import { useAppSelector } from "../store"; @@ -28,6 +28,10 @@ const Auth = () => { const [username, setUsername] = useState(mode === "dev" ? "demohero" : ""); const [password, setPassword] = useState(mode === "dev" ? "secret" : ""); + useEffect(() => { + userService.doSignOut().catch(); + }, []); + const handleUsernameInputChanged = (e: React.ChangeEvent) => { const text = e.target.value as string; setUsername(text); diff --git a/web/src/theme/index.ts b/web/src/theme/index.ts new file mode 100644 index 00000000..1d59cc39 --- /dev/null +++ b/web/src/theme/index.ts @@ -0,0 +1,15 @@ +import { extendTheme } from "@mui/joy"; + +const theme = extendTheme({ + components: { + JoySelect: { + styleOverrides: { + root: { + fontSize: "0.875rem", + }, + }, + }, + }, +}); + +export default theme;