-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from nishant0708/edit-icon
Feat:In FoodList we Can add option to Edit FoodItem Name for Canteen #310
- Loading branch information
Showing
4 changed files
with
207 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
import React, { useState } from "react"; | ||
|
||
const Modalupdate = ({ dish, onUpdate, onCancel }) => { | ||
const [updatedDish, setUpdatedDish] = useState(dish); | ||
|
||
const handleUpdate = () => { | ||
onUpdate(updatedDish); | ||
}; | ||
|
||
return ( | ||
<div className="fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center"> | ||
<div className="bg-white p-6 rounded-lg shadow-lg"> | ||
<h2 className="text-2xl mb-4">Edit Dish</h2> | ||
<input | ||
type="text" | ||
value={updatedDish} | ||
onChange={(e) => setUpdatedDish(e.target.value)} | ||
className="border border-gray-300 p-2 w-full mb-4" | ||
/> | ||
<div className="flex justify-end"> | ||
<button | ||
onClick={onCancel} | ||
className="bg-gray-300 text-black px-4 py-2 rounded mr-2" | ||
> | ||
Cancel | ||
</button> | ||
<button | ||
onClick={handleUpdate} | ||
className="bg-blue-500 text-white px-4 py-2 rounded" | ||
> | ||
Update | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Modalupdate; |
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