Feat(Contacts): Contact List

This commit is contained in:
chip committed 2020-08-22 19:27:30 +02:00
1 parent de5de7860d
commit 7a46eaf2be
2 files changed
+47 -2

No files matched your search

@@ -0,0 +1,40 @@
import React from 'react'
import { makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
import { useContacts } from "../hooks/useContacts";
import { Button } from '@material-ui/core';
import PhoneIcon from '@material-ui/icons/Phone';
import ChatIcon from '@material-ui/icons/Chat';
const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 360,
color: '#fff'
},
listItem: {
color: '#fff'
}
}));
export const ContactList = ({ children, onCall, onMessage }) => {
const classes = useStyles();
const [contacts] = useContacts();
return (
<>
<List component='nav' className={classes.root} >
{contacts.map((contact) => (
<ListItem divider className={classes.listItem}>
<ListItemText primary={contact.display} secondary={contact.phoneNumber}/>
<Button className={classes.listItem} onClick={onCall}><PhoneIcon/></Button>
<Button className={classes.listItem} onClick={onMessage}><ChatIcon/></Button>
</ListItem>
))}
</List>
</>
)
}
+7 -2
View File
@@ -6,13 +6,16 @@ import { AppTitle } from "../../../ui/components/AppTitle";
import { AppContent } from "../../../ui/components/AppContent";
import { useTranslation } from "react-i18next";
import { useContacts } from "../hooks/useContacts";
import { ContactList } from './ContactList';
const useStyles = makeStyles(() => ({
root: {
backgroundColor: lightBlue[50],
backgroundColor: '#232323',
},
title: {
backgroundColor: lightBlue[300],
textAlign: 'center'
},
}));
@@ -23,7 +26,9 @@ export const ContactsApp = () => {
return (
<AppWrapper className={classes.root}>
<AppTitle className={classes.title}>{t("APPS_CONTACTS")}</AppTitle>
<AppContent>{t("COMING_SOON")}</AppContent>
<AppContent>
<ContactList onCall={() => console.log("Calling")} onMessage={() => console.log("Opening messages")}/>
</AppContent>
</AppWrapper>
);
};