diff --git a/src/App.tsx b/src/App.tsx index 68e315d..ab0a623 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,6 @@ import { FC, useState } from "react"; import { PreLoader } from "./components/PreLoader"; +import { buttonURL } from "./constants"; import "./index.css"; import MainLayout from "./layouts/MainLayout"; import { AppRouter } from "./router"; @@ -12,23 +13,11 @@ export const App: FC = () => { const [searchString, setSearchString] = useState(""); const [searchResults, setSearchResults] = useState({ meals: [] }); const [meal, setMeal] = useState(null); - const buttonUrl = "/random"; const getRandomMeal = () => { getData("random", setMeal); }; - const getSearchResults = (e) => { - searchString === "" - ? e.preventDefault() - : getData(searchString, setSearchResults, "search"); - }; - - const handleChange = (e) => { - const { value } = e.target; - setSearchString(value); - }; - return loading ? (
@@ -36,19 +25,12 @@ export const App: FC = () => { ) : ( - + ); diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 865094d..af71ab9 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,9 +1,11 @@ -import React from "react"; +import { FC } from "react"; +import { links } from "../constants"; import { CopyrightText } from "./CopyrightText"; -import { GitHubLink } from "./GitHubLink"; import { FooterLink } from "./FooterLink"; +import { GitHubLink } from "./GitHubLink"; -export const Footer = ({ links }) => { +export const Footer: FC = () => { + const footerLinks = [...links, "random"]; return (