messageLineComponent.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import * as React from "react";
  2. import { IconProp } from "@fortawesome/fontawesome-svg-core";
  3. import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
  4. interface IMessageLineComponentProps {
  5. text: string;
  6. color?: string;
  7. icon?: IconProp;
  8. }
  9. export class MessageLineComponent extends React.Component<IMessageLineComponentProps> {
  10. constructor(props: IMessageLineComponentProps) {
  11. super(props);
  12. }
  13. render() {
  14. if (this.props.icon) {
  15. return (
  16. <div className="iconMessageLine">
  17. <div className="icon" style={{ color: this.props.color ? this.props.color : "" }}>
  18. <FontAwesomeIcon icon={this.props.icon}/>
  19. </div>
  20. <div className="value" title={this.props.text}>
  21. {this.props.text}
  22. </div>
  23. </div>
  24. );
  25. }
  26. return (
  27. <div className="messageLine">
  28. <div className="value" title={this.props.text} style={{ color: this.props.color ? this.props.color : "" }}>
  29. {this.props.text}
  30. </div>
  31. </div>
  32. );
  33. }
  34. }