您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SpeakerStatsItem.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import TimeElapsed from './TimeElapsed';
  4. /**
  5. * React component for display an individual user's speaker stats.
  6. *
  7. * @extends Component
  8. */
  9. class SpeakerStatsItem extends Component {
  10. /**
  11. * SpeakerStatsItem component's property types.
  12. *
  13. * @static
  14. */
  15. static propTypes = {
  16. /**
  17. * The name of the participant.
  18. */
  19. displayName: PropTypes.string,
  20. /**
  21. * The total milliseconds the participant has been dominant speaker.
  22. */
  23. dominantSpeakerTime: PropTypes.number,
  24. /**
  25. * True if the participant is no longer in the meeting.
  26. */
  27. hasLeft: PropTypes.bool,
  28. /**
  29. * True if the participant is currently the dominant speaker.
  30. */
  31. isDominantSpeaker: PropTypes.bool
  32. };
  33. /**
  34. * Implements React's {@link Component#render()}.
  35. *
  36. * @inheritdoc
  37. * @returns {ReactElement}
  38. */
  39. render() {
  40. const hasLeftClass = this.props.hasLeft ? 'status-user-left' : '';
  41. const rowDisplayClass = `speaker-stats-item ${hasLeftClass}`;
  42. const dotClass = this.props.isDominantSpeaker
  43. ? 'status-active' : 'status-inactive';
  44. const speakerStatusClass = `speaker-stats-item__status-dot ${dotClass}`;
  45. return (
  46. <div className = { rowDisplayClass }>
  47. <div className = 'speaker-stats-item__status'>
  48. <span className = { speakerStatusClass } />
  49. </div>
  50. <div className = 'speaker-stats-item__name'>
  51. { this.props.displayName }
  52. </div>
  53. <div className = 'speaker-stats-item__time'>
  54. <TimeElapsed
  55. time = { this.props.dominantSpeakerTime } />
  56. </div>
  57. </div>
  58. );
  59. }
  60. }
  61. export default SpeakerStatsItem;