import IconButton from '@material-ui/core/IconButton'; import {withStyles, WithStyles} from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import Delete from '@material-ui/icons/Delete'; import React from 'react'; import TimeAgo from 'react-timeago'; import Container from '../common/Container'; const styles = () => ({ header: { display: 'flex', }, headerTitle: { flex: 1, }, trash: { marginTop: -15, marginRight: -15, }, wrapperPadding: { padding: 12, }, messageContentWrapper: { width: '100%', }, image: { marginRight: 15, }, imageWrapper: { display: 'flex', }, }); type Style = WithStyles< | 'header' | 'headerTitle' | 'trash' | 'wrapperPadding' | 'messageContentWrapper' | 'image' | 'imageWrapper' >; interface IProps { title: string; image?: string; date: string; content: string; fDelete: VoidFunction; height: (height: number) => void; } class Message extends React.PureComponent { private node: HTMLDivElement | null; public componentDidMount = () => this.props.height(this.node ? this.node.getBoundingClientRect().height : 0); public render(): React.ReactNode { const {fDelete, classes, title, date, content, image} = this.props; return (
(this.node = ref)}>
app logo
{title}
{content}
); } } export default withStyles(styles)(Message);