diff --git a/README.md b/README.md
index f1acf93..efa9bc7 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
Free meal planner for cooks short on ideas! (like me …)
+[Available on](https://chefs-meal-planner.onrender.com/)
+
## Features
- Random meal suggestion
@@ -52,6 +54,7 @@ Free meal planner for cooks short on ideas! (like me …)
- Notation system: know what are the most loved meals
- Suggestions based on what your personal taste
- Recipes in Video
+- Get a full menu (Starter, Main, Dessert + Cocktail)
## Supports
@@ -68,7 +71,7 @@ Free meal planner for cooks short on ideas! (like me …)
## Versions
-### Features in V.1
+### Features in V.0.1
- WebApp
- Random meal suggestion
@@ -78,3 +81,4 @@ Free meal planner for cooks short on ideas! (like me …)
## TO DO
- put a preloader
+- change favicon
diff --git a/public/index.html b/public/index.html
index 4fba074..e536c43 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,7 +5,7 @@
-
+
@@ -25,15 +25,15 @@
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
-
Chef's Meal Planner
+ Chef's | Meal Planner
-
+ -->
You need to enable JavaScript to run this app.
diff --git a/public/manifest.json b/public/manifest.json
index 9a0ef6e..8cdd059 100644
--- a/public/manifest.json
+++ b/public/manifest.json
@@ -18,7 +18,7 @@
"sizes": "512x512"
}
],
- "start_url": ".",
+ "start_url": "/",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
diff --git a/src/App.js b/src/App.js
index 35aa7d5..f574adf 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,6 +15,7 @@ const App = () => {
// State Hooks
const [searchString, setSearchString] = useState("");
const [categories, setCategories] = useState({ categories: [] });
+ const [searchResults, setSearchResults] = useState({ meals: [] });
// const [isLoading, setIsLoading] = useState(true); For Preloader
// Default meal object. TODO: Find a better alternative …
const mealDef = {
@@ -87,8 +88,11 @@ const App = () => {
return `${ROOT}${option}.php?c=${keyword}`;
} else if (option === "lookup") {
return `${ROOT}${option}.php?i=${keyword}`;
+ } else if (option === "search") {
+ return `${ROOT}${option}.php?s=${keyword}`;
}
};
+
const getFromAPI = (keyword, set, option = null) => {
const URI = createURI(keyword, option);
fetch(URI)
@@ -111,6 +115,10 @@ const App = () => {
getFromAPI("categories", setCategories);
};
+ const getSearchResults = () => {
+ getFromAPI(searchString, setSearchResults, "search");
+ };
+
const handleChange = ev => {
const { value } = ev.target;
setSearchString(value);
@@ -121,42 +129,30 @@ const App = () => {
-
+
- (
-
- )}
+
+
+
+
+
+
/>
- (
-
- )}
- />
- (
-
- )}
+
+
+
/>
{
meal={meal}
/>
+
+
+
-
- {/* We'll have to input searchResults somewhere */}
- }
+
+
+
/>
diff --git a/src/components/SearchBar.js b/src/components/SearchBar.js
index 760ecc7..6246423 100644
--- a/src/components/SearchBar.js
+++ b/src/components/SearchBar.js
@@ -1,15 +1,31 @@
import React from "react";
+import { Link } from "react-router-dom";
const SearchBar = props => {
return (
-
+
+
+
+
+ {" "}
+ Search
+ send
+
+
+
);
};
export default SearchBar;
diff --git a/src/components/SearchResult.js b/src/components/SearchResult.js
new file mode 100644
index 0000000..97f3fa0
--- /dev/null
+++ b/src/components/SearchResult.js
@@ -0,0 +1,20 @@
+import React from "react";
+import { Link } from "react-router-dom";
+
+const SearchResult = props => {
+ const { meal } = props;
+ const { idMeal, strMeal, strMealThumb } = meal;
+
+ return (
+
+
+
+
+ {strMeal}
+
+
+
+ );
+};
+
+export default SearchResult;
diff --git a/src/components/SearchResultList.js b/src/components/SearchResultList.js
deleted file mode 100644
index bf4bb95..0000000
--- a/src/components/SearchResultList.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import React from "react";
-
-const SearchResultList = () => {
- return (
-
-
- Recipe #1
- Recipe #2
- Recipe #…
- Recipe #N
-
-
- );
-};
-
-export default SearchResultList;
diff --git a/src/pages/CategoryList.js b/src/pages/CategoryList.js
index edfdfa9..15a7613 100644
--- a/src/pages/CategoryList.js
+++ b/src/pages/CategoryList.js
@@ -2,7 +2,7 @@ import React, { useEffect } from "react";
import CategoryEntry from "../components/CategoryEntry";
const CategoryListPage = props => {
- const categories = props.categories.categories;
+ const { categories } = props.categories;
const { getCategories } = props;
useEffect(() => {
diff --git a/src/pages/Meal.js b/src/pages/Meal.js
index 90cab77..57faa87 100644
--- a/src/pages/Meal.js
+++ b/src/pages/Meal.js
@@ -47,10 +47,10 @@ const MealPage = props => {
return (
-
+
-
+
diff --git a/src/pages/Search.js b/src/pages/Search.js
index 61cd218..e4b13b8 100644
--- a/src/pages/Search.js
+++ b/src/pages/Search.js
@@ -1,18 +1,18 @@
-import React, { Component } from "react";
-import SearchResultList from "../components/SearchResultList";
+import React from "react";
+import SearchResult from "../components/SearchResult";
-export default class SearchPage extends Component {
- constructor(props) {
- super(props);
- this.initState = {};
- this.state = this.initState;
- }
- render() {
- return (
-
-
Search Results
-
-
- );
- }
-}
+const SearchPage = props => {
+ const { meals } = props.searchResults;
+ const { searchString } = props;
+
+ // console.log(meals[0]);
+ return (
+
+
Search Results for: {searchString}
+ {meals.map((meal, i) => (
+
+ ))}
+
+ );
+};
+export default SearchPage;