theme: unify theme additions type

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-12-30 15:02:27 +01:00
committed by Philipp Hugenroth
parent 91ea8e8343
commit f728b0f62e
3 changed files with 16 additions and 21 deletions
+10
View File
@@ -104,3 +104,13 @@ export type PageTheme = {
backgroundImage: string;
fontColor: string;
};
/**
* Backstage specific additions to the material-ui theme.
*
* @public
*/
export type BackstageThemeAdditions = {
page: PageTheme;
getPageTheme: (selector: PageThemeSelector) => PageTheme;
};
+3 -8
View File
@@ -21,6 +21,7 @@ import {
} from '@material-ui/core/styles/createPalette';
import {
BackstagePaletteAdditions,
BackstageThemeAdditions,
PageTheme,
PageThemeSelector,
} from '../types';
@@ -93,13 +94,7 @@ declare module '@material-ui/core/styles/createPalette' {
}
declare module '@material-ui/core/styles/createTheme' {
interface Theme {
page: PageTheme;
getPageTheme: (selector: PageThemeSelector) => PageTheme;
}
interface Theme extends BackstageThemeAdditions {}
interface ThemeOptions {
page: PageTheme;
getPageTheme: (selector: PageThemeSelector) => PageTheme;
}
interface ThemeOptions extends BackstageThemeAdditions {}
}
+3 -13
View File
@@ -14,11 +14,7 @@
* limitations under the License.
*/
import {
BackstagePaletteAdditions,
PageTheme,
PageThemeSelector,
} from '../types';
import { BackstagePaletteAdditions, BackstageThemeAdditions } from '../types';
declare module '@mui/material/styles/createPalette' {
interface Palette extends BackstagePaletteAdditions {}
@@ -27,15 +23,9 @@ declare module '@mui/material/styles/createPalette' {
}
declare module '@mui/material/styles/createTheme' {
interface Theme {
pageTheme: PageTheme;
getPageTheme: (selector: PageThemeSelector) => PageTheme;
}
interface Theme extends BackstageThemeAdditions {}
interface ThemeOptions {
pageTheme: PageTheme;
getPageTheme: (selector: PageThemeSelector) => PageTheme;
}
interface ThemeOptions extends BackstageThemeAdditions {}
}
// This is a workaround for missing methods in React 17 that MUI v5 depends on