diff --git a/src/App.tsx b/src/App.tsx index f364926..be547d9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,7 +4,6 @@ import "./index.css"; import MainLayout from "./layouts/MainLayout"; import { AppRouter } from "./router"; import { Router } from "./router/Router"; -import { getData } from "./services/api"; import { MealSummary } from "./types/meal"; import { useAuth0 } from "./utils/auth0-spa"; @@ -14,11 +13,6 @@ export const App: FC = () => { const [searchResults, setSearchResults] = useState({ meals: [] as MealSummary[], }); - const [_, setMeal] = useState(null); - - const getRandomMeal = () => { - getData("random", setMeal); - }; return loading ? (
@@ -27,7 +21,6 @@ export const App: FC = () => { ) : ( void; -}; +type Props = { openNavClick: React.MouseEventHandler }; -export const Navbar: FC = ({ openNavClick, handleClick }) => { +export const Navbar: FC = ({ openNavClick }) => { const { isAuthenticated } = useAuth0(); return ( @@ -31,7 +28,6 @@ export const Navbar: FC = ({ openNavClick, handleClick }) => { )}
  • void; color?: string; }; -export const RandomButton: FC = ({ - url, - size = "large", - handleClick, - color, -}) => { +export const RandomButton: FC = ({ url, size = "large", color }) => { const classString = `waves-effect waves-light btn-${size} ${color}`; + const { dispatch } = useMeal(); return ( - diff --git a/src/components/SideNav.tsx b/src/components/SideNav.tsx index e661774..0ceb749 100644 --- a/src/components/SideNav.tsx +++ b/src/components/SideNav.tsx @@ -9,13 +9,9 @@ import { LogInButton } from "./LogInButton"; import { LogOutButton } from "./LogOutButton"; import { RandomButton } from "./RandomButton"; -type Props = { - showNav: boolean; - closeNavClick: React.MouseEventHandler; - handleClick: () => void; -}; +type Props = { showNav: boolean; closeNavClick: React.MouseEventHandler }; -export const SideNav: FC = ({ showNav, closeNavClick, handleClick }) => { +export const SideNav: FC = ({ showNav, closeNavClick }) => { const { isAuthenticated, user } = useAuth0(); let transformStyle = { transform: showNav ? "translateX(0%)" : "translateX(-105%)", @@ -65,12 +61,7 @@ export const SideNav: FC = ({ showNav, closeNavClick, handleClick }) => {
  • - +
  • diff --git a/src/containers/Home/index.tsx b/src/containers/Home/index.tsx index 6953139..f776bf2 100644 --- a/src/containers/Home/index.tsx +++ b/src/containers/Home/index.tsx @@ -8,12 +8,7 @@ export const Home: FC = () => (

    Chef's Online Cookbook

    - {}} - /> +
    hero_image diff --git a/src/containers/NotFound/index.tsx b/src/containers/NotFound/index.tsx index 1e95be2..a0dff5e 100644 --- a/src/containers/NotFound/index.tsx +++ b/src/containers/NotFound/index.tsx @@ -15,7 +15,7 @@ export const NotFound: FC = () => ( />
    - {}} /> +
  • diff --git a/src/layouts/MainLayout.tsx b/src/layouts/MainLayout.tsx index bb28fdf..c3a6294 100644 --- a/src/layouts/MainLayout.tsx +++ b/src/layouts/MainLayout.tsx @@ -6,7 +6,6 @@ import { SideNav } from "../components/SideNav"; import { MealSummary } from "../types/meal"; type Props = { - getRandomMeal: () => void; searchString: string; setSearchString: React.Dispatch>; setSearchResults: React.Dispatch< @@ -14,7 +13,6 @@ type Props = { >; }; const MainLayout: FC = ({ - getRandomMeal, searchString, setSearchString, setSearchResults, @@ -43,18 +41,14 @@ const MainLayout: FC = ({ return ( <>
    - + - {}} - /> +
    {children}