@@ -34,7 +34,7 @@ export const Header = ({CenterComponent= <>>, SubHeader=<>>, ShouldShowSimpl
{CenterComponent}
- {ShouldShowSimpleReadSwitch && }
+ {shouldShowSimpleReadSwitch && }
diff --git a/src/components/header/SimpleReadSwitch.tsx b/src/components/header/SimpleReadSwitch.tsx
index 8dd5fcff..2703dbb7 100644
--- a/src/components/header/SimpleReadSwitch.tsx
+++ b/src/components/header/SimpleReadSwitch.tsx
@@ -1,27 +1,21 @@
-import { Icon } from "@mui/material";
-import { PBSwitch } from "../PBSwitch";
+import { Icon, Tooltip } from "@mui/material";
+import { PBSwitch, pbIconStyle } from "../PBSwitch";
+import { useTranslation } from "react-i18next"
import { useThemeContext } from "../../theme/ThemeContext";
export const SimpleReadSwitch = () => {
- const { simpleReadModeEnabled, setSimpleReadModeEnabled} = useThemeContext()
-
- const iconSx = {
- backgroundColor: 'white',
- borderRadius: 10,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- color: 'gray'
- }
+ const { theme, simpleReadModeEnabled, setSimpleReadModeEnabled} = useThemeContext()
+ const { t } = useTranslation("others")
const handleToggle = () => {
setSimpleReadModeEnabled(!simpleReadModeEnabled)
}
- return a}
- checkedIcon={A}
- onChange={handleToggle}
- />
+ return
+ a}
+ checkedIcon={A}
+ onChange={handleToggle}/>
+
}
diff --git a/src/staticData/books.ts b/src/staticData/books.ts
index 22ac57f2..5594bd95 100644
--- a/src/staticData/books.ts
+++ b/src/staticData/books.ts
@@ -55,11 +55,11 @@ const rawBooksData: RawBookData[] = [
{
id: 3,
chapterIds: ['Parametrización de soluciones'],
- simpleReadMode: true
+ simpleReadMode: false
},
{
id: 1000,
chapterIds: ['1','2','3','4','5'],
- simpleReadMode: true
+ simpleReadMode: false
},
];
diff --git a/src/theme/ThemeContext.tsx b/src/theme/ThemeContext.tsx
index add3bcdc..810903e8 100644
--- a/src/theme/ThemeContext.tsx
+++ b/src/theme/ThemeContext.tsx
@@ -3,7 +3,6 @@ import { createContext, FC, PropsWithChildren, useContext, useEffect, useMemo, u
import { getDesignTokens } from "./theme";
import { LocalStorage } from "../localStorage";
import { Ember } from "../emberCommunication";
-import { deepmerge } from '@mui/utils';
export type ThemeMode = 'light' | 'dark'
@@ -28,8 +27,8 @@ export const ThemeContextProvider: FC = ({ children }) => {
const [darkModeEnabled, setDarkModeEnabled] = useState(LocalStorage.getIsDarkMode());
const [simpleReadModeEnabled, setSimpleReadModeEnabled] = useState(LocalStorage.getIsSimpleReadMode());
- const theme = useMemo(
- () => createTheme( deepmerge(getDesignTokens(darkModeEnabled), {typography: { allVariants: { textTransform: simpleReadModeEnabled ? 'uppercase': 'initial'}}})),
+ const theme = useMemo(
+ () => createTheme( getDesignTokens(darkModeEnabled, simpleReadModeEnabled)),
[darkModeEnabled, simpleReadModeEnabled]
);
@@ -46,7 +45,6 @@ export const ThemeContextProvider: FC = ({ children }) => {
);
};
-
export const useThemeContext = () => {
return useContext(ThemeContext);
};
diff --git a/src/theme/theme.tsx b/src/theme/theme.tsx
index 02fb0b58..8c8fbbb1 100644
--- a/src/theme/theme.tsx
+++ b/src/theme/theme.tsx
@@ -77,4 +77,5 @@ const darkTheme: ThemeOptions = {
}
-export const getDesignTokens = (darkModeEnabled: boolean): ThemeOptions => deepmerge(darkModeEnabled ? darkTheme : lightTheme,commonTheme)
+export const getDesignTokens = (darkModeEnabled: boolean, simpleReadModeEnabled: boolean): ThemeOptions =>
+ deepmerge( {typography: { allVariants: { textTransform: simpleReadModeEnabled ? 'uppercase': 'initial'}}}, deepmerge(darkModeEnabled ? darkTheme : lightTheme,commonTheme))
\ No newline at end of file