-
Notifications
You must be signed in to change notification settings - Fork 8
/
RestaurantMenu.js
35 lines (30 loc) · 1.16 KB
/
RestaurantMenu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { CLOUDINARY_CDN_LINK } from "../config"
import { useDispatch } from "react-redux"
import { addItem } from "../utils/cartSlice"
const RestaurantMenu = props => {
// console.log(props)
// console.log(props.info)
// console.log(props.info.name)
const dispatch = useDispatch()
const handleAddItem = foodItem => {
// dispatch(addItem("grapes"))
dispatch(addItem(foodItem))
}
return (
<div className="border-b my-4 px-3 pt-3 pb-5 flex justify-between items-center">
<div>
<h2 className="text-orange-500 text-md">{props?.info?.name}</h2>
<h3 className="text-gray-800">{props?.info?.category}</h3>
<h4 className="text-gray-900 text-sm">{"Rs " + props?.info?.price / 100 + "/-"}</h4>
</div>
<div className="relative">
<img className="w-28 rounded-md" src={CLOUDINARY_CDN_LINK + props?.info?.imageId} alt={props?.info?.name} />
<button onClick={() => handleAddItem(props)} className="px-4 py-1 rounded-md bg-white border hover:bg-orange-100 absolute z-10 bottom-[-5] left-[25%] shadow-md">
{" "}
Add{" "}
</button>
</div>
</div>
)
}
export default RestaurantMenu