refactor: Update theme configuration and remove unused code

master^2
Tudor Stanciu 2024-07-13 20:32:04 +03:00
parent 4235323c4a
commit e3af87cd88
3 changed files with 58 additions and 34 deletions

View File

@ -1,30 +0,0 @@
import { ThemeOptions } from "@mui/material/styles";
const primary = "#00695C";
const secondary = "#DC7633";
const warning = "#ff9800";
const success = "#4caf50";
const info = "#2196f3";
export const theme: ThemeOptions = {
palette: {
mode: "light",
primary: {
main: primary
},
secondary: {
main: secondary
},
warning: {
main: warning
},
success: {
main: success
},
info: {
main: info
}
}
};
export default theme;

View File

@ -0,0 +1,55 @@
import { ThemeOptions } from "@mui/material/styles";
const primary = "#00695C";
const secondary = "#DC7633";
const warning = "#ff9800";
const success = "#4caf50";
const info = "#2196f3";
// background_default: "#f4f5fd",
export const commonTheme: ThemeOptions = {
palette: {
primary: {
main: primary
},
secondary: {
main: secondary
},
warning: {
main: warning
},
success: {
main: success
},
info: {
main: info
}
}
};
const lightThemeOptions: ThemeOptions = {
...commonTheme,
palette: {
...commonTheme.palette,
mode: "light",
background: {
default: "#fafafa",
paper: "#fff"
}
}
};
const darkThemeOptions: ThemeOptions = {
...commonTheme,
palette: {
...commonTheme.palette,
mode: "dark",
background: {
default: "#303030",
paper: "#424242"
}
}
};
export { lightThemeOptions, darkThemeOptions };

View File

@ -1,4 +1,4 @@
import defaultTheme from "./default";
import { lightThemeOptions, darkThemeOptions } from "./defaults";
import { createTheme, Theme } from "@mui/material/styles";
type Themes = {
@ -29,11 +29,10 @@ const overrides = {
};
const getThemes = (darkMode: boolean): Themes => {
const type = darkMode ? "dark" : "light";
const defaultTheme = darkMode ? darkThemeOptions : lightThemeOptions;
const dTheme = createTheme({
...defaultTheme,
...overrides,
palette: { ...defaultTheme.palette, mode: type }
...overrides
});
return {