From daf4c1135b5fd6a90bb832b93925bb3e628d2ad0 Mon Sep 17 00:00:00 2001 From: canove Date: Mon, 31 Aug 2020 12:01:28 -0300 Subject: [PATCH] improvement(style): better styles in contacts list --- frontend/src/pages/Contacts/index.js | 220 ++++++++++++++------------- 1 file changed, 113 insertions(+), 107 deletions(-) diff --git a/frontend/src/pages/Contacts/index.js b/frontend/src/pages/Contacts/index.js index 078abaa..74b882b 100644 --- a/frontend/src/pages/Contacts/index.js +++ b/frontend/src/pages/Contacts/index.js @@ -33,10 +33,15 @@ import { i18n } from "../../translate/i18n"; const useStyles = makeStyles(theme => ({ mainContainer: { flex: 1, - // backgroundColor: "#eee", padding: theme.spacing(2), height: `calc(100% - 48px)`, + }, + + contentWrapper: { + height: "100%", overflowY: "hidden", + display: "flex", + flexDirection: "column", }, contactsHeader: { @@ -46,6 +51,7 @@ const useStyles = makeStyles(theme => ({ }, actionButtons: { + flex: "none", marginLeft: "auto", "& > *": { margin: theme.spacing(1), @@ -53,16 +59,14 @@ const useStyles = makeStyles(theme => ({ }, mainPaper: { - height: "87%", + flex: 1, padding: theme.spacing(2), - overflowY: "scroll", "&::-webkit-scrollbar": { width: "8px", height: "8px", }, "&::-webkit-scrollbar-thumb": { - // borderRadius: "2px", boxShadow: "inset 0 0 6px rgba(0, 0, 0, 0.3)", backgroundColor: "#e8e8e8", }, @@ -107,11 +111,11 @@ const Contacts = () => { useEffect(() => { const socket = openSocket(process.env.REACT_APP_BACKEND_URL); socket.on("contact", data => { - if ((data.action === "update" || data.action === "create") && !loading) { + if (data.action === "update" || data.action === "create") { updateContacts(data.contact); } - if (data.action === "delete" && !loading) { + if (data.action === "delete") { deleteContact(data.contactId); } }); @@ -119,7 +123,7 @@ const Contacts = () => { return () => { socket.disconnect(); }; - }, [loading]); + }, []); const updateContacts = contact => { setContacts(prevState => { @@ -221,109 +225,111 @@ const Contacts = () => { ? `${i18n.t("contacts.confirmationModal.deleteMessage")}` : `${i18n.t("contacts.confirmationModal.importMessage")}`} -
- - {i18n.t("contacts.title")} - +
+
+ + {i18n.t("contacts.title")} + -
- - - - ), - }} - /> - - +
+ + + + ), + }} + /> + + +
-
- - - - - - {i18n.t("contacts.table.name")} - {i18n.t("contacts.table.whatsapp")} - {i18n.t("contacts.table.email")} - - {i18n.t("contacts.table.actions")} - - - - - {loading ? ( - - ) : ( - <> - {contacts.map(contact => ( - - - {} - - {contact.name} - {contact.number} - {contact.email} - - hadleEditContact(contact.id)} - > - - + +
+ + + + {i18n.t("contacts.table.name")} + {i18n.t("contacts.table.whatsapp")} + {i18n.t("contacts.table.email")} + + {i18n.t("contacts.table.actions")} + + + + + {loading ? ( + + ) : ( + <> + {contacts.map(contact => ( + + + {} + + {contact.name} + {contact.number} + {contact.email} + + hadleEditContact(contact.id)} + > + + - { - setConfirmOpen(true); - setDeletingContact(contact); - }} - > - - - - - ))} - - )} - - - - - - -
-
+ { + setConfirmOpen(true); + setDeletingContact(contact); + }} + > + + + + + ))} + + )} + + + + + + + + +
); };