mirror of
https://gitlab.com/ceda_ei/sonzai.git
synced 2025-12-24 09:30: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:
@@ -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
9
reducers/theme.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user