import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import Type from 'ba-styles/Typography.scss'; import { withStyles } from '@material-ui/core/styles'; import Send from '@material-ui/icons/Send'; import CommentIcon from '@material-ui/icons/Comment'; import CloseIcon from '@material-ui/icons/Close'; import dummy from 'ba-api/dummyContents'; import { Typography, List, ListItem, Avatar, Input, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Fab, Slide, Divider, withMobileDialog, } from '@material-ui/core'; import styles from './jss/socialMedia-jss'; const Transition = React.forwardRef(function Transition(props, ref) { // eslint-disable-line return ; }); class Comment extends React.Component { state = { comment: '' }; handleChange = event => { this.setState({ comment: event.target.value }); }; handleSubmit = comment => { this.props.submitComment(comment); this.setState({ comment: '' }); } render() { const { open, handleClose, classes, dataComment, fullScreen } = this.props; const { comment } = this.state; const getItem = dataArray => dataArray.map(data => (
{data.get('from')} {data.get('date')}
{data.get('message')}
)); return (
{' '} {dataComment !== undefined && dataComment.size}  Comment {dataComment !== undefined && dataComment.size > 1 ? 's' : ''} {dataComment !== undefined && getItem(dataComment)}
this.handleSubmit(comment)} color="secondary" aria-label="send" className={classes.button}>
); } } Comment.propTypes = { open: PropTypes.bool.isRequired, handleClose: PropTypes.func.isRequired, submitComment: PropTypes.func.isRequired, classes: PropTypes.object.isRequired, dataComment: PropTypes.object, fullScreen: PropTypes.bool.isRequired, }; Comment.defaultProps = { dataComment: undefined }; const CommentResponsive = withMobileDialog()(Comment); export default withStyles(styles)(CommentResponsive);