From 8409d09373e19cbac83cb8e4d2ed422f0a184be2 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Mon, 29 Mar 2021 12:37:53 +0200 Subject: [PATCH] refactoring (#6) * use tsx * compile * refactor Router * refactor layout * refactor home container * refactor meal container * refactor categories container * refactor category container * refactor search and profile container * refactor * move state over * move state over * css * css --- public/index.html | 45 +- src/App.tsx | 21 +- src/components/Footer.tsx | 10 +- src/components/Navbar.tsx | 10 +- src/components/RandomButton.tsx | 6 +- src/components/SearchBar.tsx | 18 +- src/components/SideNav.tsx | 50 +- src/constants.ts | 1 + src/containers/Category/index.tsx | 5 +- src/containers/Meal/index.tsx | 2 +- src/containers/NotFound/index.tsx | 9 +- src/index.css | 9318 +---------------------------- src/layouts/MainLayout.tsx | 24 +- src/layouts/PageLayout.tsx | 2 +- src/router/AppRouter.tsx | 4 +- 15 files changed, 82 insertions(+), 9443 deletions(-) diff --git a/public/index.html b/public/index.html index ba78147..22a3db3 100644 --- a/public/index.html +++ b/public/index.html @@ -1,31 +1,22 @@ - - - - - - - - - - - + + + + + + + + + + + + Online Meal Planner | Chef's - - - -
- - - + + + +
+ + diff --git a/src/App.tsx b/src/App.tsx index 68e315d..a4d84be 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,23 +12,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 +24,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 (