mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Improve hooks
This commit is contained in:
1 parent
d8f756b309
commit
34bfab2448
8 files changed
+61
-57
No files matched your search
@@ -1,40 +1,42 @@
|
||||
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';
|
||||
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 { 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'
|
||||
}
|
||||
}));
|
||||
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>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export const ContactList = ({ contacts, onCall, onMessage }) => {
|
||||
const classes = useStyles();
|
||||
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>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user