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.

AbstractOverlay.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* global $, APP */
  2. import React, { Component } from 'react';
  3. /**
  4. * Implements an abstract React Component for overlay - the components which are
  5. * displayed on top of the application covering the whole screen.
  6. *
  7. * @abstract
  8. */
  9. export default class AbstractOverlay extends Component {
  10. /**
  11. * Initializes a new AbstractOverlay instance.
  12. *
  13. * @param {Object} props - The read-only properties with which the new
  14. * instance is to be initialized.
  15. * @public
  16. */
  17. constructor(props) {
  18. super(props);
  19. this.state = {
  20. /**
  21. * Indicates the CSS style of the overlay. If true, then ighter;
  22. * darker, otherwise.
  23. *
  24. * @type {boolean}
  25. */
  26. isLightOverlay: false
  27. };
  28. }
  29. /**
  30. * This method is executed when comonent is mounted.
  31. *
  32. * @inheritdoc
  33. * @returns {void}
  34. */
  35. componentDidMount() {
  36. // XXX Temporary solution until we add React translation.
  37. APP.translation.translateElement($('#overlay'));
  38. }
  39. /**
  40. * Implements React's {@link Component#render()}.
  41. *
  42. * @inheritdoc
  43. * @returns {ReactElement|null}
  44. */
  45. render() {
  46. const containerClass
  47. = this.state.isLightOverlay
  48. ? 'overlay__container-light'
  49. : 'overlay__container';
  50. return (
  51. <div
  52. className = { containerClass }
  53. id = 'overlay'>
  54. <div className = 'overlay__content'>
  55. {
  56. this._renderOverlayContent()
  57. }
  58. </div>
  59. </div>
  60. );
  61. }
  62. /**
  63. * Reloads the page.
  64. *
  65. * @returns {void}
  66. * @protected
  67. */
  68. _reconnectNow() {
  69. // FIXME: In future we should dispatch an action here that will result
  70. // in reload.
  71. APP.ConferenceUrl.reload();
  72. }
  73. /**
  74. * Abstract method which should be used by subclasses to provide the overlay
  75. * content.
  76. *
  77. * @returns {ReactElement|null}
  78. * @protected
  79. */
  80. _renderOverlayContent() {
  81. return null;
  82. }
  83. }