This commit is contained in:
Ruidy Nemausat 2020-01-27 20:01:41 +01:00
parent 0a9a00dbc3
commit cb9f6e3ed8
9 changed files with 44 additions and 28 deletions

View file

@ -2,14 +2,14 @@
Free meal planner for cooks short on ideas! (like me …) Free meal planner for cooks short on ideas! (like me …)
[Available on](https://chefs-meal-planner.onrender.com/) [v.0.1 Available Here!](https://chefs-meal-planner.onrender.com/)
## Features ## Features
- Random meal suggestion - Random meal suggestion
- Search by name: you're look for a recipe? Ours are easy to make and Yummy! - Search by name: you're look for a recipe? Ours are easy to make and Yummy!
- What's in the fridge ? Choose your main ingredient and get a meal suggestion - What's in the fridge ? Choose your main ingredient and get a meal suggestion
- Choose by category: - Choose by category:
- Beef - Beef
- Breakfast - Breakfast
- Chicken - Chicken
@ -55,10 +55,11 @@ Free meal planner for cooks short on ideas! (like me …)
- Suggestions based on what your personal taste - Suggestions based on what your personal taste
- Recipes in Video - Recipes in Video
- Get a full menu (Starter, Main, Dessert + Cocktail) - Get a full menu (Starter, Main, Dessert + Cocktail)
- Send a daily suggestion to newsletter
## Supports ## Supports
- Web - Web
- Progressive Web App - Progressive Web App
- Mobile - Mobile
@ -71,7 +72,7 @@ Free meal planner for cooks short on ideas! (like me …)
## Versions ## Versions
### Features in V.0.1 ### Features in v.0.1
- WebApp - WebApp
- Random meal suggestion - Random meal suggestion
@ -82,3 +83,5 @@ Free meal planner for cooks short on ideas! (like me …)
- put a preloader - put a preloader
- change favicon - change favicon
- visual styling
- route bad request to notFOund (exple: /categories/string)

View file

@ -93,7 +93,7 @@ const App = () => {
} }
}; };
const getFromAPI = (keyword, set, option = null) => { const getData = (keyword, set, option = null) => {
const URI = createURI(keyword, option); const URI = createURI(keyword, option);
fetch(URI) fetch(URI)
.then(response => response.json()) .then(response => response.json())
@ -103,20 +103,20 @@ const App = () => {
// Fetch wrappers for each use // Fetch wrappers for each use
const getRandomMeal = () => { const getRandomMeal = () => {
// setIsLoading(true); // setIsLoading(true);
getFromAPI("random", setMeal); getData("random", setMeal);
// setIsLoading(false); // setIsLoading(false);
}; };
const getMeal = id => { const getMeal = id => {
getFromAPI(id, setMeal, "lookup"); getData(id, setMeal, "lookup");
}; };
const getCategories = () => { const getCategories = () => {
getFromAPI("categories", setCategories); getData("categories", setCategories);
}; };
const getSearchResults = () => { const getSearchResults = () => {
getFromAPI(searchString, setSearchResults, "search"); getData(searchString, setSearchResults, "search");
}; };
const handleChange = ev => { const handleChange = ev => {
@ -156,7 +156,7 @@ const App = () => {
/> />
<Route path="/categories/:strCategory/"> <Route path="/categories/:strCategory/">
<CategoryPage <CategoryPage
getFromAPI={getFromAPI} getData={getData}
getMeal={getMeal} getMeal={getMeal}
setMeal={setMeal} setMeal={setMeal}
meal={meal} meal={meal}

1
src/images/Chef.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

1
src/images/breakfast.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 20 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -10,19 +10,11 @@ body {
flex-direction: column; flex-direction: column;
} }
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
main {
flex: 1 0 auto;
}
div { div {
white-space: pre-wrap; white-space: pre-wrap;
} }
.background { .background {
background-image: url(./images/parallax1.jpg); background-image: url(./images/Chef.svg);
/* width: 100%; */
} }

View file

@ -3,11 +3,11 @@ import { useParams, Link, useRouteMatch } from "react-router-dom";
const CategoryPage = props => { const CategoryPage = props => {
const [meals, setMeals] = useState({ meals: [] }); const [meals, setMeals] = useState({ meals: [] });
const { getFromAPI } = props; const { getData } = props;
const { strCategory } = useParams(); const { strCategory } = useParams();
const getMeals = () => { const getMeals = () => {
getFromAPI(strCategory, setMeals, "filter"); getData(strCategory, setMeals, "filter");
}; };
useEffect(() => { useEffect(() => {

View file

@ -3,10 +3,27 @@ import RandomButton from "../components/RandomButton";
const HomePage = props => { const HomePage = props => {
return ( return (
<div className="section background"> <div className="section ">
<div className="container center-align"> <div className="container ">
<h1>The Chef's Meal Suggestions</h1> <div className="row">
<RandomButton handleClick={props.handleClick} url={props.buttonUrl} /> <div className="col s12 m6">
<h1>The Chef's Meal Suggestions</h1>
<RandomButton
handleClick={props.handleClick}
url={props.buttonUrl}
/>
</div>
<div className="col s12 m6">
<img
// src={require("../images/breakfast.svg")}
// src={require("../images/Chef.svg")}
src={require("../images/healthy_options.svg")}
// src={require("../images/special_event.svg")}
alt="hero_image"
width="100%"
/>
</div>
</div>
</div> </div>
</div> </div>
); );