diff options
Diffstat (limited to 'subprojects/frontend/src/theme/ThemeProvider.tsx')
-rw-r--r-- | subprojects/frontend/src/theme/ThemeProvider.tsx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/subprojects/frontend/src/theme/ThemeProvider.tsx b/subprojects/frontend/src/theme/ThemeProvider.tsx index 7bda1ede..78146f25 100644 --- a/subprojects/frontend/src/theme/ThemeProvider.tsx +++ b/subprojects/frontend/src/theme/ThemeProvider.tsx | |||
@@ -1,3 +1,9 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
1 | import { | 7 | import { |
2 | alpha, | 8 | alpha, |
3 | createTheme, | 9 | createTheme, |
@@ -6,7 +12,6 @@ import { | |||
6 | type ThemeOptions, | 12 | type ThemeOptions, |
7 | ThemeProvider as MaterialUiThemeProvider, | 13 | ThemeProvider as MaterialUiThemeProvider, |
8 | type TypographyStyle, | 14 | type TypographyStyle, |
9 | useTheme, | ||
10 | type CSSObject, | 15 | type CSSObject, |
11 | } from '@mui/material/styles'; | 16 | } from '@mui/material/styles'; |
12 | import { observer } from 'mobx-react-lite'; | 17 | import { observer } from 'mobx-react-lite'; |
@@ -70,7 +75,7 @@ function createResponsiveTheme( | |||
70 | ...options, | 75 | ...options, |
71 | typography: { | 76 | typography: { |
72 | fontFamily: | 77 | fontFamily: |
73 | '"InterVariable", "Inter", "Roboto", "Helvetica", "Arial", sans-serif', | 78 | '"Inter Variable", "Inter", "Roboto", "Helvetica", "Arial", sans-serif', |
74 | fontWeightMedium: 600, | 79 | fontWeightMedium: 600, |
75 | fontWeightEditorNormal: 400, | 80 | fontWeightEditorNormal: 400, |
76 | fontWeightEditorBold: 700, | 81 | fontWeightEditorBold: 700, |
@@ -80,7 +85,7 @@ function createResponsiveTheme( | |||
80 | }, | 85 | }, |
81 | editor: { | 86 | editor: { |
82 | fontFamily: | 87 | fontFamily: |
83 | '"JetBrains MonoVariable", "JetBrains Mono", "Cascadia Code", "Fira Code", monospace', | 88 | '"JetBrains Mono Variable", "JetBrains Mono", "Cascadia Code", "Fira Code", monospace', |
84 | fontFeatureSettings: '"liga", "calt"', | 89 | fontFeatureSettings: '"liga", "calt"', |
85 | // `rem` for JetBrains MonoVariable make the text too large in Safari. | 90 | // `rem` for JetBrains MonoVariable make the text too large in Safari. |
86 | fontSize: '16px', | 91 | fontSize: '16px', |
@@ -350,15 +355,14 @@ export function ContrastThemeProvider({ | |||
350 | }: { | 355 | }: { |
351 | children?: ReactNode; | 356 | children?: ReactNode; |
352 | }): JSX.Element { | 357 | }): JSX.Element { |
353 | const theme = useTheme(); | ||
354 | const contrastTheme = useContext(ContrastThemeContext); | 358 | const contrastTheme = useContext(ContrastThemeContext); |
355 | if (!contrastTheme) { | 359 | if (!contrastTheme) { |
356 | throw new Error('ContrastThemeProvider must be used within ThemeProvider'); | 360 | throw new Error('ContrastThemeProvider must be used within ThemeProvider'); |
357 | } | 361 | } |
358 | return ( | 362 | return ( |
359 | <ThemeAndContrastThemeProvider theme={contrastTheme} contrastTheme={theme}> | 363 | <MaterialUiThemeProvider theme={contrastTheme}> |
360 | {children} | 364 | {children} |
361 | </ThemeAndContrastThemeProvider> | 365 | </MaterialUiThemeProvider> |
362 | ); | 366 | ); |
363 | } | 367 | } |
364 | 368 | ||
@@ -378,7 +382,7 @@ const ThemeProvider = observer(function ThemeProvider({ | |||
378 | return ( | 382 | return ( |
379 | <ThemeAndContrastThemeProvider | 383 | <ThemeAndContrastThemeProvider |
380 | theme={darkMode ? darkTheme : lightTheme} | 384 | theme={darkMode ? darkTheme : lightTheme} |
381 | contrastTheme={darkMode ? lightTheme : darkTheme} | 385 | contrastTheme={darkTheme} |
382 | > | 386 | > |
383 | {children} | 387 | {children} |
384 | </ThemeAndContrastThemeProvider> | 388 | </ThemeAndContrastThemeProvider> |