chore: add theme file for joyui (#635)

This commit is contained in:
boojack 2022-11-29 20:15:16 +08:00 committed by GitHub
parent ab8e3473a1
commit 55f37664ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 10 deletions

View file

@ -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 (
<CssVarsProvider>
<CssVarsProvider theme={theme}>
<RouterProvider router={router} />
</CssVarsProvider>
);

View file

@ -21,7 +21,7 @@ const ApperanceSelect = () => {
return (
<Select
className="!min-w-[12rem] w-auto text-sm"
className="!min-w-[10rem] w-auto text-sm"
value={apperance}
onChange={(_, value) => {
setApperance(value as Apperance);

View file

@ -34,7 +34,7 @@ const SearchBar = () => {
<div className="search-bar-container">
<div className="search-bar-inputer">
<Icon.Search className="icon-img" />
<input className="text-input" type="text" placeholder="" value={queryText} onChange={handleTextQueryInput} />
<input className="text-input" autoComplete="off" type="text" placeholder="" value={queryText} onChange={handleTextQueryInput} />
</div>
<div className="quickly-action-wrapper">
<div className="quickly-action-container">

View file

@ -63,7 +63,6 @@ const UserBanner = () => {
};
const handleSignOutBtnClick = async () => {
userService.doSignOut().catch();
navigate("/auth");
};

View file

@ -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;
}
}

View file

@ -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<HTMLInputElement>) => {
const text = e.target.value as string;
setUsername(text);

15
web/src/theme/index.ts Normal file
View file

@ -0,0 +1,15 @@
import { extendTheme } from "@mui/joy";
const theme = extendTheme({
components: {
JoySelect: {
styleOverrides: {
root: {
fontSize: "0.875rem",
},
},
},
},
});
export default theme;