Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 25 additions & 33 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ const useStyles = makeStyles((theme) => ({
}));

const gloBlue = "#0669de";
const darkBlue = "#07366E";
const darkNavy = "#020c18";
const darkPaper = "#05182E";

const initialState = { mode: "light" };

Expand All @@ -118,44 +121,33 @@ function reducer(state, action) {
const App = () => {
const classes = useStyles();
const [state, dispatch] = useReducer(reducer, initialState, initializer);
const themeMode = state.mode;

const palette =
themeMode === "light"
? {
primary: { main: gloBlue },
secondary: { main: gloBlue },
primary1Color: gloBlue,
}
: {
primary: { main: darkBlue },
secondary: { main: gloBlue },
background: { default: darkNavy, paper: darkPaper },
primary1Color: gloBlue,
};

const typography = {
useNextVariants: true,
};

const theme = useMemo(
() =>
createMuiTheme({
palette: {
...(state.mode === "light"
? {
// light mode
primary: {
main: gloBlue,
},
secondary: {
main: gloBlue,
},
primary1Color: gloBlue,
type: state.mode,
}
: {
// dark mode
primary: {
main: "#07366E",
},
secondary: {
main: gloBlue,
},
background: {
default: "#020c18",
paper: "#05182E",
},
primary1Color: gloBlue,
type: state.mode,
}),
},
typography: {
useNextVariants: true,
},
palette: { ...palette, type: themeMode },
typography,
}),
[state.mode]
[themeMode]
);

useEffect(() => {
Expand Down