1
0
mirror of https://gitlab.com/ceda_ei/sonzai.git synced 2025-11-04 09:00:05 +01:00

Add Theme Picker.

Moved Provider into App.js. Add AppContainer to store theme in redux
store. Add reducers and actions for theme, SET_THEME.
This commit is contained in:
2020-03-17 19:25:03 +05:30
parent 635dbbf709
commit 0103e6abff
8 changed files with 260 additions and 46 deletions

View File

@@ -3,11 +3,13 @@ import { combineReducers } from "redux";
import timetable from "./timetable";
import classes from "./classes";
import subjects from "./subjects";
import theme from "./theme";
const rootReducer = combineReducers({
timetable,
classes,
subjects,
theme,
});
export default rootReducer;

9
reducers/theme.js Normal file
View File

@@ -0,0 +1,9 @@
import themes from "../themes";
export default function theme(state, action) {
if (typeof state === "undefined")
return themes[0].theme;
if (action.type === "SET_THEME") {
return action.theme;
}
return state;
}