Skip to content

Commit ed01fbe

Browse files
committed
adjusted theme
1 parent d0863d2 commit ed01fbe

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

web-app/src/app/context/ThemeProvider.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ import {
77
import { getTheme, ThemeModeEnum } from '../Theme';
88
import type ContextProviderProps from '../interface/ContextProviderProps';
99

10-
interface ThemeContextValue {
11-
mode: ThemeModeEnum;
12-
toggleTheme: () => void;
13-
}
14-
15-
const ThemeContext = createContext<ThemeContextValue>({
16-
mode: ThemeModeEnum.light,
17-
toggleTheme: () => {}
18-
});
10+
const ThemeContext = createContext({ toggleTheme: () => {} });
1911

2012
function getInitialThemeMode(prefersDarkMode: boolean): ThemeModeEnum {
2113
if (localStorage.getItem('theme') != undefined) {
@@ -41,7 +33,7 @@ export const ThemeProvider: React.FC<ContextProviderProps> = ({ children }) => {
4133
const theme = useMemo(() => getTheme(mode), [mode]);
4234

4335
return (
44-
<ThemeContext.Provider value={{ mode, toggleTheme }}>
36+
<ThemeContext.Provider value={{ toggleTheme }}>
4537
<MuiThemeProvider theme={theme}>
4638
<CssBaseline />
4739
{children}
@@ -50,5 +42,5 @@ export const ThemeProvider: React.FC<ContextProviderProps> = ({ children }) => {
5042
);
5143
};
5244

53-
export const useTheme = (): ThemeContextValue =>
45+
export const useTheme = (): { toggleTheme: () => void } =>
5446
useContext(ThemeContext);

0 commit comments

Comments
 (0)