import React from "react"; import { PropTypes } from "prop-types"; import { Tag } from "antd"; import styles from "./Dialog.module.css"; export default class DialogView extends React.Component { render() { let selectedStyle = `${styles.block}`; let hint; let bgColor; let date; if (this.props.hint) { hint = {this.props.hint}; } if (this.props.bg) { bgColor = this.props.bg; } if (this.props.selected) { selectedStyle = `${selectedStyle} ${styles.block_selected}`; hint = (
Selected Message
); if (this.props.hint) { hint = (
{this.props.hint}
); } } if (this.props.date) { date = {this.props.date}; } return (
{this.props.name}: 

{this.props.text}

{date} {hint}
); } } DialogView.propTypes = { name: PropTypes.string.isRequired, text: PropTypes.string.isRequired, selected: PropTypes.bool, date: PropTypes.string, hint: PropTypes.string, };