diff --git a/src/App.css b/src/App.css index 74b5e05..c94ab51 100644 --- a/src/App.css +++ b/src/App.css @@ -1,38 +1,9 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; +body { display: flex; + min-height: 100vh; flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; } -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } +main { + flex: 1 0 auto; } diff --git a/src/App.js b/src/App.js index 5328c90..682520d 100644 --- a/src/App.js +++ b/src/App.js @@ -6,11 +6,11 @@ import SearchPage from "./pages/Search"; import NotFound from "./pages/NotFound"; import Navbar from "./components/Navbar"; import Footer from "./components/Footer"; +// import "./App.css"; const App = () => { const [searchString, setSearchString] = useState(""); - - const mealItem = { + const mealDef = { meals: [ { idMeal: "52837", @@ -69,24 +69,48 @@ const App = () => { } ] }; + const [mealItem, setMeal] = useState(mealDef); + const URI = "https://www.themealdb.com/api/json/v1/1/random.php"; + + const getMeal = () => { + fetch(URI) + .then(response => response.json()) + .then(mealItem => setMeal(mealItem)); + }; + + // const { mealItem } = meal; const handleChange = ev => { const { value } = ev.target; setSearchString(value); }; + const handleClick = () => { + getMeal(); + }; + return ( - + - + ( + + )} + /> } /> - {/* We'll have to input searchString somewhere */} + {/* We'll have to input searchResults somewhere */}