-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
101 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
|
||
import {Restaurant} from "./model/Restaurant.ts"; | ||
import "./styles/RestaurantCard.css" | ||
|
||
type RestaurantCardProps = { | ||
restaurant: Restaurant; | ||
onDeleteRestaurant: (id:string)=>void | ||
onDeleteRestaurant?: (id: string) => void | ||
onToggleWishlist: (id: string) => void | ||
} | ||
|
||
function RestaurantCard(props: Readonly<RestaurantCardProps>) { | ||
|
||
return ( | ||
<div className="restaurantCard"> | ||
<div className="restaurantCard"> | ||
<h3>{props.restaurant.name}</h3> | ||
<h4>{props.restaurant.city}</h4> | ||
<h4>{props.restaurant.category}</h4> | ||
<button id="button-delete" onClick={() => props.onDeleteRestaurant(props.restaurant.id)}>Delete</button> | ||
|
||
</div> | ||
<button>Details</button> | ||
<button>Edit</button> | ||
<button id="button-delete" onClick={() => props.onDeleteRestaurant?.(props.restaurant.id)} | ||
disabled={!props. onDeleteRestaurant}>Delete</button> | ||
<button id="" onClick={() => props.onToggleWishlist(props.restaurant.id)} | ||
className={props.restaurant.status === "ON_WISHLIST" ? "red" : "black"} | ||
>♥</button> | ||
</div> | ||
|
||
); | ||
} | ||
|
||
export default RestaurantCard; | ||
export default RestaurantCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {Restaurant} from "./model/Restaurant.ts"; | ||
import RestaurantCard from "./RestaurantCard.tsx"; | ||
|
||
type WishlistProps = { | ||
restaurants: Restaurant []; | ||
onToggleWishlist: (id:string)=>void; | ||
|
||
} | ||
|
||
export default function Wishlist(props: Readonly<WishlistProps>){ | ||
return( | ||
<div> | ||
<h2>Wishlist</h2> | ||
|
||
<h2>Restaurantfinder</h2> | ||
{props.restaurants.map((r) => <RestaurantCard key={r.id} restaurant={r} onToggleWishlist={props.onToggleWishlist}/>)} | ||
|
||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
export type WishlistStatus = " ON_WISHLIST" | "NOT_ON_WISHLIST" | "REMOVED_FROM_WISHLIST" | ||
export type WishlistStatus = "ON_WISHLIST" | "NOT_ON_WISHLIST" | "REMOVED_FROM_WISHLIST" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters