Comment.jsx 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react'
  2. import classnames from 'classnames'
  3. const Comment = props => {
  4. const styleSent = {
  5. color: '#fdfdfd',
  6. backgroundColor: props.customColor
  7. }
  8. const styleReceived = {
  9. color: '#333',
  10. backgroundColor: '#fdfdfd'
  11. }
  12. return (
  13. <li className={classnames(
  14. `${props.customClass}__messagelist__item`,
  15. 'timeline__body__messagelist__item', {
  16. 'sent': props.fromMe,
  17. 'received': !props.fromMe
  18. }
  19. )}>
  20. <div className={classnames(`${props.customClass}__messagelist__item__wrapper`, 'timeline__body__messagelist__item__wrapper')}>
  21. <div className={classnames(`${props.customClass}__messagelist__item__avatar`, 'timeline__body__messagelist__item__avatar')}>
  22. <img src={props.avatar} />
  23. </div>
  24. </div>
  25. <div className={classnames(`${props.customClass}__messagelist__item__authorandhour`, 'timeline__body__messagelist__item__authorandhour')}>
  26. <div className={classnames(`${props.customClass}__messagelist__item__authorandhour__author`, 'timeline__body__messagelist__item__authorandhour__author')}>
  27. {props.author}
  28. </div>
  29. <div className={classnames(`${props.customClass}__messagelist__item__authorandhour__date`, 'timeline__body__messagelist__item__authorandhour__date')}>
  30. {props.createdAt}
  31. </div>
  32. </div>
  33. <div
  34. className={classnames(`${props.customClass}__messagelist__item__content`, 'timeline__body__messagelist__item__content')}
  35. style={props.fromMe ? styleSent : styleReceived}
  36. dangerouslySetInnerHTML={{__html: props.text}}
  37. />
  38. </li>
  39. )
  40. }
  41. export default Comment