diff --git a/README.md b/README.md
index a75202e..550b8d5 100644
--- a/README.md
+++ b/README.md
@@ -87,4 +87,3 @@ Free meal planner for cooks short on ideas! (like me …)
- Use ErrorBoundaries component ?
- add sidenav on mobile
- contact form
-- override Router with scoll to top function
diff --git a/public/manifest.json b/public/manifest.json
index b6e857e..96a6f51 100644
--- a/public/manifest.json
+++ b/public/manifest.json
@@ -25,6 +25,6 @@
],
"start_url": "/",
"display": "standalone",
- "theme_color": "#000000",
+ "theme_color": "#ee6e73",
"background_color": "#ffffff"
}
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index 14296d0..99a960e 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,41 +1,37 @@
import React, { useState } from "react";
-import {
- BrowserRouter as Router,
- Switch,
- Route,
- Redirect
-} from "react-router-dom";
-import HomePage from "./pages/Home";
-import MealPage from "./pages/Meal";
-import SearchPage from "./pages/Search";
-import CategoryListPage from "./pages/CategoryList";
-import CategoryPage from "./pages/Category";
-import NotFound from "./pages/NotFound";
-import Navbar from "./components/Navbar";
-import SearchBar from "./components/SearchBar";
-import Footer from "./components/Footer";
+import { Router } from "./utils/router";
+import { Switch, Route, Redirect } from "react-router-dom";
+import { HomePage } from "./pages/Home";
+import { MealPage } from "./pages/Meal";
+import { SearchPage } from "./pages/Search";
+import { CategoryListPage } from "./pages/CategoryList";
+import { CategoryPage } from "./pages/Category";
+import { NotFoundPage } from "./pages/NotFound";
+import { Navbar } from "./components/Navbar";
+import { SearchBar } from "./components/SearchBar";
+import { Footer } from "./components/Footer";
import "./index.css";
+import { getData } from "./utils/methods";
-const App = () => {
+export const App = () => {
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 = {
meals: [
{
idMeal: "52837",
- strMeal: "Pilchard puttanesca",
+ strMeal: "Chef's meal",
strDrinkAlternate: null,
- strCategory: "Pasta",
- strArea: "Italian",
+ strCategory: "yummy",
+ strArea: "Mine",
strInstructions:
"Cook the pasta following pack instructions.\r\n\r\nHeat the oil in a non-stick frying pan and cook the onion, garlic and chilli for 3-4 mins to soften. Stir in the tomato pur\u00e9e and cook for 1 min, then add the pilchards with their sauce. Cook, breaking up the fish with a wooden spoon, then add the olives and continue to cook for a few more mins.\r\n\r\nDrain the pasta and add to the pan with 2-3 tbsp of the cooking water. Toss everything together well, then divide between plates and serve, scattered with Parmesan.",
- strMealThumb:
- "https://www.themealdb.com/images/media/meals/vvtvtr1511180578.jpg",
+ strMealThumb: require("./images/breakfast.svg"),
+ // "https://www.themealdb.com/images/media/meals/vvtvtr1511180578.jpg",
strTags: null,
- strYoutube: "https://www.youtube.com/watch?v=wqZzLAPmr9k",
+ strYoutube: "#",
strIngredient1: "Spaghetti",
strIngredient2: "Olive Oil",
strIngredient3: "Onion",
@@ -83,26 +79,6 @@ const App = () => {
};
const [meal, setMeal] = useState(mealDef);
- const createURI = (keyword, option) => {
- const ROOT = "https://www.themealdb.com/api/json/v1/1/";
- if (option === null) {
- return `${ROOT}${keyword}.php`;
- } else if (option === "filter") {
- 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 getData = (keyword, set, option = null) => {
- const URI = createURI(keyword, option);
- fetch(URI)
- .then(response => response.json())
- .then(data => set(data));
- };
-
const getRandomMeal = () => {
getData("random", setMeal);
};
@@ -129,32 +105,24 @@ const App = () => {
return (
-
-
-
+
-
+
-
-
{
/>
-
+
@@ -183,5 +151,3 @@ const App = () => {
);
};
-
-export default App;
diff --git a/src/components/CardEntry.js b/src/components/CardEntry.js
index cf58434..ef9739d 100644
--- a/src/components/CardEntry.js
+++ b/src/components/CardEntry.js
@@ -1,7 +1,7 @@
import React from "react";
import { Link } from "react-router-dom";
-const CardEntry = props => {
+export const CardEntry = props => {
const { idMeal, strMeal, strMealThumb } = props.item;
return (
@@ -22,4 +22,3 @@ const CardEntry = props => {
);
};
-export default CardEntry;
diff --git a/src/components/CategoryEntry.js b/src/components/CategoryEntry.js
index 128e14c..c506fa7 100644
--- a/src/components/CategoryEntry.js
+++ b/src/components/CategoryEntry.js
@@ -12,7 +12,7 @@ const CategoryEntry = props => {
return (
//
-
+
diff --git a/src/components/CopyrightText.js b/src/components/CopyrightText.js
index aa411ba..dcc57ba 100644
--- a/src/components/CopyrightText.js
+++ b/src/components/CopyrightText.js
@@ -1,6 +1,6 @@
import React from "react";
-const CopyrightText = () => {
+export const CopyrightText = () => {
return (
© 2020 - Chef's - Made with{" "}
@@ -10,5 +10,3 @@ const CopyrightText = () => {
);
};
-
-export default CopyrightText;
diff --git a/src/components/Footer.js b/src/components/Footer.js
index 1f391c6..3cb4e33 100644
--- a/src/components/Footer.js
+++ b/src/components/Footer.js
@@ -1,8 +1,8 @@
import React from "react";
-import CopyrightText from "./CopyrightText";
-import GitHubLink from "./GitHubLink";
+import { CopyrightText } from "./CopyrightText";
+import { GitHubLink } from "./GitHubLink";
-const Footer = () => {
+export const Footer = () => {
return (