mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
Make List and ListItem reusable
This commit is contained in:
1 parent
d36ef4ce38
commit
eb570f21b3
5 files changed
+45
-36
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import React from "react";
|
||||
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";
|
||||
import { List } from "../../../ui/components/List";
|
||||
import { ListItem } from "../../../ui/components/ListItem";
|
||||
|
||||
export const ContactList = ({ contacts, onCall, onMessage }) => {
|
||||
return (
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import React from 'react';
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import React from "react";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback';
|
||||
import PhoneForwardedIcon from '@material-ui/icons/PhoneForwarded';
|
||||
import PhoneCallbackIcon from "@material-ui/icons/PhoneCallback";
|
||||
import PhoneForwardedIcon from "@material-ui/icons/PhoneForwarded";
|
||||
import { List } from "../../../ui/components/List";
|
||||
import { ListItem } from "../../../ui/components/ListItem";
|
||||
|
||||
const CallTypeIcon = {
|
||||
incoming: <PhoneCallbackIcon />,
|
||||
outgoing: <PhoneForwardedIcon />,
|
||||
};
|
||||
|
||||
export const PhoneList = ({ calls }) => {
|
||||
const CallTypeIcon = {'incoming': <PhoneCallbackIcon />, 'outgoing': <PhoneForwardedIcon />}
|
||||
|
||||
return (
|
||||
<List>
|
||||
{calls.map((call) => (
|
||||
<ListItem key={call.id} divider>
|
||||
<ListItemText
|
||||
primary={call.caller}
|
||||
secondary={call.phoneNumber}
|
||||
/>
|
||||
{CallTypeIcon[call.type]}
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<List>
|
||||
{calls.map((call) => (
|
||||
<ListItem key={call.id} divider>
|
||||
<ListItemText primary={call.caller} secondary={call.phoneNumber} />
|
||||
{CallTypeIcon[call.type]}
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from "react";
|
||||
import {
|
||||
ListItem,
|
||||
List,
|
||||
ListItemIcon,
|
||||
ListItemText,
|
||||
Slide,
|
||||
makeStyles,
|
||||
Paper,
|
||||
} from "@material-ui/core";
|
||||
import { List } from "./List";
|
||||
import { ListItem } from "./ListItem";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -34,7 +34,7 @@ export const ContextMenu = ({ open, onClose, options }) => {
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>{option.icon}</ListItemIcon>
|
||||
{option.icon && <ListItemIcon>{option.icon}</ListItemIcon>}
|
||||
<ListItemText primary={option.label} />
|
||||
</ListItem>
|
||||
))}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from 'react'
|
||||
import List from '@material-ui/core/List';
|
||||
import React from "react";
|
||||
import MaterialList from "@material-ui/core/List";
|
||||
|
||||
export const PhoneList = (props) => {
|
||||
|
||||
return (
|
||||
<List component='nav' className={props.className} aria-label='mailbox folders'>
|
||||
{props.children}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
export const List = ({ ...props }) => {
|
||||
return (
|
||||
<MaterialList {...props} aria-label="list">
|
||||
{props.children}
|
||||
</MaterialList>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import MaterialListItem from "@material-ui/core/ListItem";
|
||||
|
||||
export const ListItem = ({ ...props }) => {
|
||||
return (
|
||||
<MaterialListItem {...props} aria-label="list item">
|
||||
{props.children}
|
||||
</MaterialListItem>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user