import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; import Edit from '@material-ui/icons/Edit'; import Star from '@material-ui/icons/Star'; import StarBorder from '@material-ui/icons/StarBorder'; import MoreVertIcon from '@material-ui/icons/MoreVert'; import LocalPhone from '@material-ui/icons/LocalPhone'; import Email from '@material-ui/icons/Email'; import Smartphone from '@material-ui/icons/Smartphone'; import LocationOn from '@material-ui/icons/LocationOn'; import Work from '@material-ui/icons/Work'; import Language from '@material-ui/icons/Language'; import { List, ListItem, ListItemText, ListItemAvatar, Avatar, Menu, MenuItem, IconButton, Typography, Divider, } from '@material-ui/core'; import styles from './contact-jss'; const optionsOpt = [ 'Block Contact', 'Delete Contact', 'Option 1', 'Option 2', 'Option 3', ]; const ITEM_HEIGHT = 48; class ContactDetail extends React.Component { state = { anchorElOpt: null, }; handleClickOpt = event => { this.setState({ anchorElOpt: event.currentTarget }); }; handleCloseOpt = () => { this.setState({ anchorElOpt: null }); }; deleteContact = (item) => { this.props.remove(item); this.setState({ anchorElOpt: null }); } render() { const { classes, dataContact, itemSelected, edit, favorite, showMobileDetail } = this.props; const { anchorElOpt } = this.state; return (
favorite(dataContact.get(itemSelected))}> {dataContact.getIn([itemSelected, 'favorited']) ? () : } edit(dataContact.get(itemSelected))}> {optionsOpt.map(option => { if (option === 'Delete Contact') { return ( this.deleteContact(dataContact.get(itemSelected))}> {option} ); } return ( {option} ); })}
{dataContact.getIn([itemSelected, 'name'])} {dataContact.getIn([itemSelected, 'title'])}
); } } ContactDetail.propTypes = { classes: PropTypes.object.isRequired, showMobileDetail: PropTypes.bool.isRequired, dataContact: PropTypes.object.isRequired, itemSelected: PropTypes.number.isRequired, edit: PropTypes.func.isRequired, remove: PropTypes.func.isRequired, favorite: PropTypes.func.isRequired, }; export default withStyles(styles)(ContactDetail);