UI Mechanics / New Look (orange - gray)
This commit is contained in:
@@ -4,8 +4,6 @@ const appModeReducer = (state = "init", action) => {
|
||||
return (state = "init");
|
||||
case "APP_SEARCH_RESULTS":
|
||||
return (state = "search results");
|
||||
case "APP_LOGIN":
|
||||
return (state = "login");
|
||||
case "APP_RESTAURANT":
|
||||
return (state = "restaurant");
|
||||
case "APP_DISH":
|
||||
|
||||
36
src/reducers/data.js
Normal file
36
src/reducers/data.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const initialState = {
|
||||
showDishList: false,
|
||||
loggedIn: false,
|
||||
jwt: "",
|
||||
username: "",
|
||||
dialogs: {
|
||||
logIn: false,
|
||||
register: false,
|
||||
contact: false,
|
||||
pricing: false,
|
||||
},
|
||||
};
|
||||
|
||||
const data = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case "SET_DISHLIST_VISIBLE":
|
||||
return (state = { ...state, showDishList: true });
|
||||
case "SET_DISHLIST_HIDDEN":
|
||||
return (state = { ...state, showDishList: false });
|
||||
case "DIALOG_LOGIN_VISIBLE":
|
||||
return (state = { ...state, dialogs: { ...state.dialogs, logIn: true } });
|
||||
case "SET_LOGGEDIN":
|
||||
return (state = { ...state, loggedIn: true, username: action.payload });
|
||||
case "SET_LOGGEDOUT":
|
||||
return (state = { ...state, loggedIn: false, username: "" });
|
||||
case "DIALOG_LOGIN_HIDDEN":
|
||||
return (state = {
|
||||
...state,
|
||||
dialogs: { ...state.dialogs, logIn: false },
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default data;
|
||||
@@ -5,7 +5,7 @@ import appMode from "./appMode";
|
||||
import searchQuery from "./searchQuery";
|
||||
import restaurant from "./restaurant";
|
||||
import dishes from "./dishes";
|
||||
import toggles from "./toggles";
|
||||
import data from "./data";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
autocomplete: autoCompleteReducer,
|
||||
@@ -14,7 +14,7 @@ const rootReducer = combineReducers({
|
||||
searchQuery: searchQuery,
|
||||
restaurant: restaurant,
|
||||
dishes: dishes,
|
||||
toggles: toggles,
|
||||
data: data,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
const initialState = {
|
||||
showDishList: false,
|
||||
};
|
||||
|
||||
const toggles = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case "SET_DISHLIST_VISIBLE":
|
||||
return (state = { ...state, showDishList: true });
|
||||
case "SET_DISHLIST_HIDDEN":
|
||||
return (state = { ...state, showDishList: false });
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default toggles;
|
||||
Reference in New Issue
Block a user