Guest User

Untitled

a guest
May 8th, 2025
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. export default function ModalForm({isOpen, onClose, mode, onSubmit}) {
  2. return (
  3. <>
  4. {/* You can open the modal using document.getElementById('ID').showModal() method */}
  5. <button className="btn" onClick={()=>document.getElementById('my_modal_3').showModal()}>open modal</button>
  6. <dialog id="my_modal_3" className="modal" open={isOpen}>
  7. <div className="modal-box"
  8. >
  9. <h3 className="font-bold text-lg py-4" >{mode === 'edit' ? 'Edit Client' : 'Client Details'} </h3>
  10. <form method="dialog">
  11.  
  12. <label className="input input-bordered flex items-center gap-2">
  13.  
  14. Name
  15. <input type="text" className="grow" placeholder="Daisy" />
  16.  
  17. </label>
  18. <label className="input input-bordered flex items-center gap-2">
  19.  
  20. Email
  21. <input type="text" className="grow" placeholder="Daisy" />
  22.  
  23. </label>
  24. <label className="input input-bordered flex items-center gap-2">
  25.  
  26. Job
  27. <input type="text" className="grow" placeholder="Daisy" />
  28.  
  29. </label>
  30. <div className="flex mb-4 justify-between">
  31. <label className="input input-bordered flex items-center gap-2">
  32.  
  33. Rate
  34. <input type="number" className="grow" placeholder="Daisy" />
  35.  
  36. </label>
  37.  
  38. <select defaultValue="Pick a color" className="select">
  39. <option>Inactive</option>
  40. <option>Active</option>
  41.  
  42. </select>
  43. </div>
  44. {/* if there is a button in form, it will close the modal */}
  45. <button className="btn btn-sm btn-circle btn-ghost absolute right-2 top-2" onClick={onClose}>X</button>
  46. <button className="btn btn-success">{mode === 'edit' ? 'Save Changes' : 'Add Client'}</button>
  47. </form>
  48.  
  49. </div>
  50. </dialog>
  51. </>
  52. )
  53. };
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment