Skip to content

Commit

Permalink
Edit contact UI updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nirmal1064 committed Feb 24, 2023
1 parent 0b1dff8 commit 690f7e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/ContactModal.jsx
Expand Up @@ -7,7 +7,7 @@ const ContactModal = ({ show, handleClose, type, contact }) => {
const nameRef = useRef(null);
const phoneRef = useRef(null);
const addressRef = useRef(null);
const { addContact, setErrorMsg } = useContacts();
const { addContact, setErrorMsg, editContact } = useContacts();

const handleSubmit = async (e) => {
e.preventDefault();
Expand All @@ -28,7 +28,7 @@ const ContactModal = ({ show, handleClose, type, contact }) => {
address: addressRef.current.value
};
if (type === "Edit") {
// Yet to implement
await editContact(contactToSave, contact.id);
} else {
await addContact(contactToSave);
}
Expand Down
3 changes: 3 additions & 0 deletions src/index.css
@@ -0,0 +1,3 @@
.icon {
cursor: pointer;
}
8 changes: 7 additions & 1 deletion src/pages/ContactList.jsx
Expand Up @@ -70,7 +70,13 @@ const ContactList = () => {
<td>{contact.phone}</td>
<td>{contact.address}</td>
<td className="d-flex flex-row justify-content-around">
<i className="bi bi-pencil-square"></i>
<i
className="bi bi-pencil-square icon"
onClick={() => {
setActiveContact(contact);
setType("Edit");
setShowContactModal(true);
}}></i>
<i className="bi bi-trash3"></i>
</td>
</tr>
Expand Down

0 comments on commit 690f7e0

Please sign in to comment.