import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import FavoriteIcon from '@material-ui/icons/Favorite'; import ShareIcon from '@material-ui/icons/Share'; import Comment from '@material-ui/icons/Comment'; import MoreVertIcon from '@material-ui/icons/MoreVert'; import { Typography, Card, Menu, MenuItem, CardHeader, CardMedia, CardContent, CardActions, IconButton, Avatar, } from '@material-ui/core'; import styles from './cardStyle-jss'; const optionsOpt = [ 'Report this post', 'Hide this post', 'Copy link', ]; const ITEM_HEIGHT = 48; class PostCard extends React.Component { state = { anchorElOpt: null }; handleClickOpt = event => { this.setState({ anchorElOpt: event.currentTarget }); }; handleCloseOpt = () => { this.setState({ anchorElOpt: null }); }; render() { const { classes, avatar, name, date, image, content, liked, shared, commented } = this.props; const { anchorElOpt } = this.state; return ( } action={( )} title={name} subheader={date} /> {optionsOpt.map(option => ( {option} ))} { image !== '' && ( ) } {content} 0 && classes.liked} /> {liked} 0 && classes.shared} /> {shared} {commented} ); } } PostCard.propTypes = { classes: PropTypes.object.isRequired, avatar: PropTypes.string.isRequired, name: PropTypes.string.isRequired, date: PropTypes.string.isRequired, image: PropTypes.string, content: PropTypes.string.isRequired, liked: PropTypes.number.isRequired, shared: PropTypes.number.isRequired, commented: PropTypes.number.isRequired, }; PostCard.defaultProps = { image: '' }; export default withStyles(styles)(PostCard);