Created
September 21, 2021 14:02
-
-
Save harrybanda/f668e3531399f75a2e2398b7cde5cd47 to your computer and use it in GitHub Desktop.
BookDialog.js
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
import ForgeUI, { ModalDialog, Form, TextField } from "@forge/ui"; | |
export const BookDialog = ({ books, setBooks, isOpenModal, setOpenModal }) => { | |
const onSubmit = async (formData) => { | |
setBooks([...books, formData]); | |
setOpenModal(false); | |
}; | |
return ( | |
isOpenModal && ( | |
<ModalDialog header="Add Book" onClose={() => setOpenModal(false)}> | |
<Form onSubmit={onSubmit}> | |
<TextField name="bookname" label="Book Name" /> | |
<TextField name="author" label="Author" /> | |
<TextField name="quantity" label="Quantity" /> | |
<TextField name="price" label="Price" /> | |
</Form> | |
</ModalDialog> | |
) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment