aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/components/Themer.tsx
diff options
context:
space:
mode:
authorQuentin Gliech <quentingliech@gmail.com>2022-02-22 21:50:14 +0100
committerQuentin Gliech <quentingliech@gmail.com>2022-02-22 21:50:14 +0100
commitfd17d6dd1f7c9fbda4d3c3e2c2eb232bd9086fab (patch)
tree436108fbaa0d386b642768a90e90c1ad33d6fad2 /webui/src/components/Themer.tsx
parentb0eb041e571dd616a9926d969bb42b3e7d6512e9 (diff)
downloadgit-bug-fd17d6dd1f7c9fbda4d3c3e2c2eb232bd9086fab.tar.gz
webui: upgrade Material UI
Diffstat (limited to 'webui/src/components/Themer.tsx')
-rw-r--r--webui/src/components/Themer.tsx21
1 files changed, 14 insertions, 7 deletions
diff --git a/webui/src/components/Themer.tsx b/webui/src/components/Themer.tsx
index 063587e3..9934888d 100644
--- a/webui/src/components/Themer.tsx
+++ b/webui/src/components/Themer.tsx
@@ -1,11 +1,15 @@
-import { createContext, useContext, useState } from 'react';
+import { NightsStayRounded, WbSunnyRounded } from '@mui/icons-material';
+import { ThemeProvider, StyledEngineProvider } from '@mui/material';
+import IconButton from '@mui/material/IconButton';
+import Tooltip from '@mui/material/Tooltip';
+import { Theme } from '@mui/material/styles';
import * as React from 'react';
+import { createContext, useContext, useState } from 'react';
-import { ThemeProvider } from '@material-ui/core';
-import IconButton from '@material-ui/core/IconButton';
-import Tooltip from '@material-ui/core/Tooltip';
-import { Theme } from '@material-ui/core/styles';
-import { NightsStayRounded, WbSunnyRounded } from '@material-ui/icons';
+declare module '@mui/styles/defaultTheme' {
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface DefaultTheme extends Theme {}
+}
const ThemeContext = createContext({
toggleMode: () => {},
@@ -26,6 +30,7 @@ const LightSwitch = ({ className }: LightSwitchProps) => {
onClick={toggleMode}
aria-label={description}
className={className}
+ size="large"
>
{mode === 'light' ? <WbSunnyRounded /> : <NightsStayRounded />}
</IconButton>
@@ -53,7 +58,9 @@ const Themer = ({ children, lightTheme, darkTheme }: Props) => {
return (
<ThemeContext.Provider value={{ toggleMode: toggleMode, mode: mode }}>
- <ThemeProvider theme={preferedTheme}>{children}</ThemeProvider>
+ <StyledEngineProvider injectFirst>
+ <ThemeProvider theme={preferedTheme}>{children}</ThemeProvider>
+ </StyledEngineProvider>
</ThemeContext.Provider>
);
};