import { makeStyles } from '@material-ui/core' import { useState } from 'react'; import { useDispatch } from 'react-redux'; import { styled } from '@mui/material/styles'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import ListItemButton from '@mui/material/ListItemButton'; import Avatar from '@mui/material/Avatar'; import ListItemText from '@mui/material/ListItemText'; import ListItemIcon from '@mui/material/ListItemIcon'; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import {removeContact } from '../../../../../api-data'; import { actionIsOpen } from '../../../../../redux/control/action'; import { TContact } from '../../../../../typescript/redux/contacts/types'; import { TIsOpen } from '../../../../../typescript/redux/control/types'; import { firstLetter,slicedWord,timeStampEU,copied } from '../../../../../helpers'; const StyledMenu = styled((props:any) => (
))(({ theme }:any) => ({ '& .MuiPaper-root': { borderRadius: 10, marginTop: theme.spacing(0), minWidth: 220, color: theme.palette.mode === 'light' ? 'rgb(55, 65, 81)' : theme.palette.grey[500], boxShadow: 'rgb(255, 255, 255) 0px 0px 0px 0px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px, rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px', '& .MuiMenu-list': { padding: '14px 14px', }, '& .MuiMenuItem-root': { marginBottom: theme.spacing(1), '& .MuiSvgIcon-root': { fontSize: 21, color: theme.palette.text.secondary, marginRight: theme.spacing(4), } }, }, })); const useStyles = makeStyles({ listItem_iconAvatar: { marginRight:10 }, }) interface IContactItem { contact: TContact, selectedIndex: null | number, setSelectedIndex: (i: null | number) => void, i: number, handleListItemClick: (companionId: string) => void, isOpen: TIsOpen, } const ContactItem = ({contact,selectedIndex,setSelectedIndex,i,handleListItemClick,isOpen}:IContactItem) => { const classes = useStyles() const dispatch = useDispatch() const [anchorEl, setAnchorEl] = useState