You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Subject.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { connect } from '../../../base/redux';
  4. import { isToolboxVisible } from '../../../toolbox';
  5. /**
  6. * The type of the React {@code Component} props of {@link Subject}.
  7. */
  8. type Props = {
  9. /**
  10. * The subject of the conference.
  11. */
  12. _subject: string,
  13. /**
  14. * Indicates whether the component should be visible or not.
  15. */
  16. _visible: boolean
  17. };
  18. /**
  19. * Subject react component.
  20. *
  21. * @class Subject
  22. */
  23. class Subject extends Component<Props> {
  24. /**
  25. * Implements React's {@link Component#render()}.
  26. *
  27. * @inheritdoc
  28. * @returns {ReactElement}
  29. */
  30. render() {
  31. const { _subject, _visible } = this.props;
  32. return (
  33. <div className = { `subject ${_visible ? 'visible' : ''}` }>
  34. { _subject }
  35. </div>
  36. );
  37. }
  38. }
  39. /**
  40. * Maps (parts of) the Redux state to the associated
  41. * {@code Subject}'s props.
  42. *
  43. * @param {Object} state - The Redux state.
  44. * @private
  45. * @returns {{
  46. * _subject: string,
  47. * _visible: boolean
  48. * }}
  49. */
  50. function _mapStateToProps(state) {
  51. const { subject } = state['features/base/conference'];
  52. return {
  53. _subject: subject,
  54. _visible: isToolboxVisible(state)
  55. };
  56. }
  57. export default connect(_mapStateToProps)(Subject);