diff --git a/.gitignore b/.gitignore index 705ca36..19d6a6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ node_modules/ -/.idea \ No newline at end of file +/.idea +.env \ No newline at end of file diff --git a/TODO.md b/TODO.md index 1fcf4a3..895dfe8 100644 --- a/TODO.md +++ b/TODO.md @@ -14,3 +14,4 @@ - [ ] Use Css-in-Js - [ ] Redirect to 404 - [x] Typescript +- [ ] strict typing diff --git a/package.json b/package.json index 2fcae70..212fa14 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "devDependencies": { "@types/node": "^14.14.37", "@types/react": "^17.0.3", + "@types/react-router-dom": "^5.1.7", "typescript": "^4.2.3" } } diff --git a/src/App.tsx b/src/App.tsx index a4d84be..f364926 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,13 +5,16 @@ 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"; export const App: FC = () => { const { loading } = useAuth0(); const [searchString, setSearchString] = useState(""); - const [searchResults, setSearchResults] = useState({ meals: [] }); - const [meal, setMeal] = useState(null); + const [searchResults, setSearchResults] = useState({ + meals: [] as MealSummary[], + }); + const [_, setMeal] = useState(null); const getRandomMeal = () => { getData("random", setMeal); diff --git a/src/components/ContactForm.tsx b/src/components/ContactForm.tsx deleted file mode 100644 index 0023d31..0000000 --- a/src/components/ContactForm.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import React, { useState } from "react"; -// import { notificationMail, confirmationMail } from "../utils/mail"; - -export const ContactForm = ({ setIsSubmitted }) => { - const [firstName, setFirstName] = useState(""); - const [lastName, setLastName] = useState(""); - const [email, setEmail] = useState(""); - const [phone, setPhone] = useState(""); - const [message, setMessage] = useState(""); - - const handleSubmit = (e) => { - e.preventDefault(); - // confirmationMail(email); - // const body = `Sender: ${firstName} ${lastName}\nPhone: ${phone}\nMessage: ${message}`; - // notificationMail(email, `New message from ${firstName} ${lastName}`, body); - setIsSubmitted(true); - }; - - return ( -
-
-
-
- -
-
- -
-
- -
-
- -
-
- - -
-
-
-
- ); -}; - -const ContactFormInput = ({ id, type = "text", value, dispatch }) => { - const handleChange = (e) => { - e.preventDefault(); - dispatch(e.target.value); - }; - - return ( -
- {/* account_circle */} - - -
- ); -}; - -const ContactFormTextArea = ({ id, value, dispatch }) => { - const handleChange = (e) => { - e.preventDefault(); - dispatch(e.target.value); - }; - - return ( -
- -