diff --git a/public/index.html b/public/index.html index 68565f5..b86e6b1 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - + diff --git a/public/manifest.json b/public/manifest.json index 25fb19e..bfe2b78 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -25,6 +25,6 @@ ], "start_url": "/", "display": "standalone", - "theme_color": "#ee6e73", + "theme_color": "#ff6d00", "background_color": "#ffffff" -} +} \ No newline at end of file diff --git a/src/pages/App.jsx b/src/App.jsx similarity index 75% rename from src/pages/App.jsx rename to src/App.jsx index 0cb004b..0297712 100644 --- a/src/pages/App.jsx +++ b/src/App.jsx @@ -1,29 +1,29 @@ import React, { useState } from "react"; -import { Router } from "../utils/router"; +import { Router } from "./utils/router"; import { Switch, Route, Redirect } from "react-router-dom"; -import { useAuth0 } from "../utils/auth0-spa"; -import { Home } from "./Home"; -import { Meal } from "./Meal"; -import { SearchPage } from "./Search"; -import { CategoryListPage } from "./CategoryList"; -import { CategoryPage } from "./Category"; -import { ContactPage } from "./Contact"; -import { NotFoundPage } from "./NotFound"; -import { Navbar } from "../components/Navbar"; -import { SearchBar } from "../components/SearchBar"; -import { Footer } from "../components/Footer"; -import { getData } from "../utils/methods"; -import history from "../utils/history"; -import { Profile } from "./Profile"; -import { PrivateRoute } from "../components/PrivateRoute"; -import { PreLoader } from "../components/PreLoader"; -import { SideNav } from "../components/SideNav"; -import "../index.css"; +import { useAuth0 } from "./utils/auth0-spa"; +import { SearchController } from "./controllers/SearchController"; +import { ContactPage } from "./pages/Contact"; +import { NotFoundPage } from "./pages/NotFoundPage"; +import { Navbar } from "./components/Navbar"; +import { SearchBar } from "./components/SearchBar"; +import { Footer } from "./components/Footer"; +import { getData } from "./utils/methods"; +import history from "./utils/history"; +import { ProfileController } from "./controllers/ProfileController"; +import { PrivateRoute } from "./components/PrivateRoute"; +import { PreLoader } from "./components/PreLoader"; +import { SideNav } from "./components/SideNav"; +import "./index.css"; +import { HomeController } from "./controllers/HomeController"; +import { MealController } from "./controllers/MealController"; +import { CategoryListController } from "./controllers/CategoryListController"; +import { CategoryController } from "./controllers/CategoryController"; export const App = () => { const { loading } = useAuth0(); const [searchString, setSearchString] = useState(""); - const [categories, setCategories] = useState({ categories: [] }); + const [searchResults, setSearchResults] = useState({ meals: [] }); // Default meal object. TODO: Find a better alternative … const mealDef = { @@ -36,7 +36,7 @@ export const App = () => { 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: require("../images/breakfast.svg"), + strMealThumb: require("./images/breakfast.svg"), // "https://www.themealdb.com/images/media/meals/vvtvtr1511180578.jpg", strTags: null, strYoutube: "#", @@ -87,16 +87,12 @@ export const App = () => { }; const [meal, setMeal] = useState(mealDef); - const getRandomMeal = () => { - getData("random", setMeal); - }; - const getMeal = id => { getData(id, setMeal, "lookup"); }; - const getCategories = () => { - getData("categories", setCategories); + const getRandomMeal = () => { + getData("random", setMeal); }; const getSearchResults = e => { @@ -167,39 +163,31 @@ export const App = () => { - + - + - {meal !== undefined && meal.meals !== null ? ( - - ) : ( - - )} + - + - + - @@ -214,11 +202,11 @@ export const App = () => { - {meal !== undefined && meal.meals !== null ? ( - - ) : ( - - )} + diff --git a/src/components/CardEntry.jsx b/src/components/CardEntry.jsx index 65bb6fb..df97621 100644 --- a/src/components/CardEntry.jsx +++ b/src/components/CardEntry.jsx @@ -6,15 +6,13 @@ export const CardEntry = props => { return (
  • -
    -
    -
    -
    - {strMeal} -
    -
    -

    {strMeal}

    -
    +
    +
    +
    + {strMeal} +
    +
    +

    {strMeal}

    diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index c76d6f5..92c1629 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -7,10 +7,9 @@ import { FooterLink } from "./FooterLink"; import { LogInButton } from "./LogInButton"; import { LogOutButton } from "./LogOutButton"; -export const Navbar = props => { +export const Navbar = ({ openNavClick, links, buttonUrl, handleClick }) => { const { isAuthenticated } = useAuth0(); - const { openNavClick, links } = props; return (