new look / search list / restaurant view

This commit is contained in:
2020-07-24 20:27:05 +02:00
parent 2ab445670e
commit ad2a945965
14 changed files with 208 additions and 44 deletions

14
src/reducers/dishes.js Normal file
View File

@@ -0,0 +1,14 @@
const dishes = (state = [], action) => {
switch (action.type) {
case "SET_DISHES":
return (state = action.payload);
case "ADD_DISH":
return [...state, action.payload];
case "CLEAR_DISHES":
return (state = []);
default:
return state;
}
};
export default dishes;

View File

@@ -3,12 +3,16 @@ import autoCompleteReducer from "./autoComplete";
import searchResults from "./searchResults";
import appMode from "./appMode";
import searchQuery from "./searchQuery";
import restaurant from "./restaurant";
import dishes from "./dishes";
const rootReducer = combineReducers({
autocomplete: autoCompleteReducer,
appMode: appMode,
searchResults: searchResults,
searchQuery: searchQuery,
restaurant: restaurant,
dishes: dishes,
});
export default rootReducer;

View File

@@ -0,0 +1,12 @@
const restaurant = (state = {}, action) => {
switch (action.type) {
case "SET_RESTAURANT":
return (state = action.payload);
case "CLEAR_RESTAURANT":
return (state = {});
default:
return state;
}
};
export default restaurant;