From fecfc95982747b8bbdf79d183ef1e807857d6a41 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 25 Sep 2021 15:40:11 +0200 Subject: [PATCH] minor refactorings --- src/App.tsx | 3 +- src/components/CardEntry.tsx | 35 ++++++++------- src/components/CopyrightText.tsx | 6 +-- src/components/Footer.tsx | 3 +- src/components/FooterLink.tsx | 10 ++--- src/components/GitHubLink.tsx | 4 +- src/components/LogInButton.tsx | 17 +++----- src/components/LogOutButton.tsx | 8 ++-- src/components/Logo.tsx | 25 +++++------ src/components/Navbar.tsx | 22 +++------- src/components/PreLoader.tsx | 4 +- src/components/RandomButton.tsx | 3 +- src/components/SearchBar.tsx | 14 +++--- src/components/SideNav.tsx | 18 ++++---- .../Categories/components/CategoriesEntry.tsx | 3 +- .../Categories/components/CategoriesPage.tsx | 9 +--- src/containers/Categories/index.tsx | 4 +- .../Category/components/CategoryPage.tsx | 3 +- src/containers/Category/index.tsx | 4 +- .../Contact/components/ContactForm.tsx | 43 ++++--------------- .../Contact/components/ContactFormInput.tsx | 13 ++---- .../components/ContactFormSubmitButton.tsx | 10 +---- .../components/ContactFormSubmitted.tsx | 24 +++++------ .../components/ContactFormTextArea.tsx | 6 +-- src/containers/Contact/index.tsx | 4 +- src/containers/Home/index.tsx | 3 +- .../Meal/components/MealIngredientList.tsx | 8 +--- src/containers/Meal/components/MealPage.tsx | 10 +---- .../Meal/components/MealPresentation.tsx | 26 +++-------- src/containers/Meal/components/MealRecipe.tsx | 8 +--- src/containers/Meal/index.tsx | 4 +- src/containers/NotFound/index.tsx | 3 +- .../Profile/components/ProfilePage.tsx | 10 +---- src/containers/Profile/index.tsx | 4 +- .../Search/components/SearchPage.tsx | 7 +-- .../Search/components/SearchResult.tsx | 7 +-- src/containers/Search/index.tsx | 14 +++--- src/layouts/MainLayout.tsx | 10 ++--- src/router/AppRouter.tsx | 5 +-- src/router/PrivateRoute.tsx | 13 ++---- src/router/index.ts | 3 +- src/services/api.ts | 11 +++-- src/setupTests.ts | 6 +-- src/types/meal.ts | 2 +- src/utils/{methods.ts => string.ts} | 0 45 files changed, 152 insertions(+), 297 deletions(-) rename src/utils/{methods.ts => string.ts} (100%) diff --git a/src/App.tsx b/src/App.tsx index e3dcd93..53cfff0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,3 @@ -import { FC } from "react"; import { PreLoader } from "./components/PreLoader"; import "./index.css"; import MainLayout from "./layouts/MainLayout"; @@ -6,7 +5,7 @@ import { AppRouter } from "./router"; import { Router } from "./router/Router"; import { useAuth0 } from "./utils/auth0-spa"; -export const App: FC = () => { +export const App = () => { const { loading } = useAuth0(); return loading ? ( diff --git a/src/components/CardEntry.tsx b/src/components/CardEntry.tsx index 48df395..bbe6195 100644 --- a/src/components/CardEntry.tsx +++ b/src/components/CardEntry.tsx @@ -1,4 +1,3 @@ -import { FC } from "react"; import { Link } from "react-router-dom"; import { MealSummary } from "../types/meal"; @@ -7,22 +6,22 @@ type Props = { className?: string; }; -export const CardEntry: FC = ({ meal, className = "col s12 m6" }) => { - const { idMeal, strMeal, strMealThumb } = meal; - return ( - -
  • -
    -
    -
    - {strMeal} -
    -
    -

    {strMeal}

    -
    +export const CardEntry = ({ + meal: { idMeal, strMeal, strMealThumb }, + className = "col s12 m6", +}: Props) => ( + +
  • +
    +
    +
    + {strMeal} +
    +
    +

    {strMeal}

    -
  • - - ); -}; + + + +); diff --git a/src/components/CopyrightText.tsx b/src/components/CopyrightText.tsx index 70d0c54..8fd001f 100644 --- a/src/components/CopyrightText.tsx +++ b/src/components/CopyrightText.tsx @@ -1,8 +1,6 @@ -import { FC } from "react"; - -export const CopyrightText: FC = () => ( +export const CopyrightText = () => ( - © 2020 - Chef's - Made with{" "} + © {new Date().getFullYear()} - Chef's - Made with{" "} ❤️ diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index af71ab9..82de02f 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,10 +1,9 @@ -import { FC } from "react"; import { links } from "../constants"; import { CopyrightText } from "./CopyrightText"; import { FooterLink } from "./FooterLink"; import { GitHubLink } from "./GitHubLink"; -export const Footer: FC = () => { +export const Footer = () => { const footerLinks = [...links, "random"]; return (