@@ -44,7 +54,7 @@ export const SearchBar = ({
type="submit"
name="searchButton"
value="Search"
- onClick={onSubmit}
+ onClick={getSearchResults}
>
send
diff --git a/src/components/SideNav.tsx b/src/components/SideNav.tsx
index de22271..30f2193 100644
--- a/src/components/SideNav.tsx
+++ b/src/components/SideNav.tsx
@@ -1,18 +1,14 @@
-import React from "react";
import { Link } from "react-router-dom";
+import { buttonURL, links } from "../constants";
+import ChefImage from "../images/chef.svg";
+import SpecialEventImage from "../images/special_event.svg";
import { useAuth0 } from "../utils/auth0-spa";
-import { RandomButton } from "./RandomButton";
import { FooterLink } from "./FooterLink";
import { LogInButton } from "./LogInButton";
import { LogOutButton } from "./LogOutButton";
+import { RandomButton } from "./RandomButton";
-export const SideNav = ({
- showNav,
- closeNavClick,
- links,
- buttonUrl,
- handleClick,
-}) => {
+export const SideNav = ({ showNav, closeNavClick, handleClick }) => {
const { isAuthenticated, user } = useAuth0();
let transformStyle = {
transform: showNav ? "translateX(0%)" : "translateX(-105%)",
@@ -25,7 +21,6 @@ export const SideNav = ({
@@ -49,28 +43,24 @@ export const SideNav = ({
close
- {isAuthenticated ? (
-
-

-
{user.name}
-
{user.email}
-
- ) : (
- //
-
})
- //
- )}
+
+ {isAuthenticated ? (
+
+

+
{user.name}
+
{user.email}
+
+ ) : (
+

+ )}
+
@@ -86,7 +76,7 @@ export const SideNav = ({
-
+
diff --git a/src/constants.ts b/src/constants.ts
index 03f6af4..1ab5cfb 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -1 +1,2 @@
export const buttonURL = "/random";
+export const links = ["categories", "contact"];
diff --git a/src/containers/Category/index.tsx b/src/containers/Category/index.tsx
index 7223cf1..12c8728 100644
--- a/src/containers/Category/index.tsx
+++ b/src/containers/Category/index.tsx
@@ -7,11 +7,10 @@ export const Category: FC = () => {
const { strCategory } = useParams();
const [meals, setMeals] = useState({ meals: [] });
- const getMeals = () => getData(strCategory, setMeals, "filter");
-
useEffect(() => {
+ const getMeals = () => getData(strCategory, setMeals, "filter");
getMeals();
- }, []);
+ }, [strCategory]);
return !meals.meals ? (
diff --git a/src/containers/Meal/index.tsx b/src/containers/Meal/index.tsx
index 66ef870..658e9dd 100644
--- a/src/containers/Meal/index.tsx
+++ b/src/containers/Meal/index.tsx
@@ -70,6 +70,6 @@ export const Meal: FC = () => {
handleFavChange={handleFavChange}
/>
) : (
-
+
);
};
diff --git a/src/containers/NotFound/index.tsx b/src/containers/NotFound/index.tsx
index 11e0719..46e8a37 100644
--- a/src/containers/NotFound/index.tsx
+++ b/src/containers/NotFound/index.tsx
@@ -1,11 +1,8 @@
import { FC } from "react";
import { RandomButton } from "../../components/RandomButton";
+import { getRandomMeal } from "../Meal/service";
-type Props = {
- handleClick: (any) => void;
-};
-
-export const NotFound: FC = ({ handleClick }) => (
+export const NotFound: FC = () => (
Wrong Way!
@@ -21,7 +18,7 @@ export const NotFound: FC
= ({ handleClick }) => (
diff --git a/src/layouts/MainLayout.tsx b/src/layouts/MainLayout.tsx
index e00915e..d1f30e6 100644
--- a/src/layouts/MainLayout.tsx
+++ b/src/layouts/MainLayout.tsx
@@ -6,24 +6,18 @@ import { SideNav } from "../components/SideNav";
// TODO FC...
const MainLayout = ({
- buttonUrl,
getRandomMeal,
- handleChange,
searchString,
setSearchString,
- getSearchResults,
setSearchResults,
children,
}) => {
const [showNav, setShowNav] = useState(false);
- const links = ["categories", "contact"];
-
const openNavClick = (e) => {
e.preventDefault();
setShowNav(true);
document.addEventListener("keydown", handleEscKey);
- // document.addEventListener("click", handleOutsideClick);
};
const closeNavClick = (e) => {
@@ -37,37 +31,25 @@ const MainLayout = ({
setShowNav(false);
}
};
- // const handleOutsideClick = e => {
- // console.log(e);
- // };
return (
<>
- {children}
-
+ {children}
+
>
);
};
diff --git a/src/layouts/PageLayout.tsx b/src/layouts/PageLayout.tsx
index 6fc282b..04e0f1c 100644
--- a/src/layouts/PageLayout.tsx
+++ b/src/layouts/PageLayout.tsx
@@ -7,7 +7,7 @@ type Props = {
const PageLayout: FC = ({ title, children }) => (
{title}
- {children}
+ {children}
);
diff --git a/src/router/AppRouter.tsx b/src/router/AppRouter.tsx
index 373be83..a2c5bb2 100644
--- a/src/router/AppRouter.tsx
+++ b/src/router/AppRouter.tsx
@@ -12,7 +12,7 @@ import { PrivateRoute } from "./PrivateRoute";
//TODO: remove state from router move to containers
-const AppRouter = ({ getRandomMeal, searchString, searchResults }) => (
+const AppRouter = ({ searchString, searchResults }) => (
@@ -41,7 +41,7 @@ const AppRouter = ({ getRandomMeal, searchString, searchResults }) => (
-
+