Skip to content

Commit

Permalink
add Home
Browse files Browse the repository at this point in the history
  • Loading branch information
Ropold committed Nov 18, 2024
1 parent 1beeb06 commit 8dfcb8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import './App.css'
import axios from "axios";
import {useEffect, useState} from "react";
import {Restaurant} from "./components/model/Restaurant.ts";
import RestaurantCard from "./components/RestaurantCard.tsx";
import Home from "./components/Home/Home.tsx"



export default function App() {

const [restaurants, setRestaurants] = useState<Restaurant[]>()
const [restaurants, setRestaurants] = useState<Restaurant[]>([])

const getAllRestaurants = () => {
axios.get("/api/restaurant").then(
Expand All @@ -23,8 +23,7 @@ export default function App() {

return (
<>
<h2>Restaurantfinder</h2>
{restaurants?.map(r => (<RestaurantCard restaurant={r} key={r.id}/>))}
<Home restaurants={restaurants}/>
</>
);
}
17 changes: 17 additions & 0 deletions frontend/src/components/Home/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Restaurant} from "../model/Restaurant";
import RestaurantCard from "../RestaurantCard.tsx";


type Props = {
restaurants: Restaurant [];
}

export default function Home(props: Props){
return(
<div>
<h2>Home2</h2>
<h2>Restaurantfinder</h2>
{props.restaurants.map((r)=><RestaurantCard key={r.id} restaurant={r}/>)}
</div>
)
}

0 comments on commit 8dfcb8d

Please sign in to comment.