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 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement|null}
  34. */
  35. render() {
  36. const containerClass
  37. = this.state.isLightOverlay
  38. ? 'overlay__container-light'
  39. : 'overlay__container';
  40. return (
  41. <div
  42. className = { containerClass }
  43. id = 'overlay'>
  44. <div className = 'overlay__content'>
  45. {
  46. this._renderOverlayContent()
  47. }
  48. </div>
  49. </div>
  50. );
  51. }
  52. /**
  53. * Reloads the page.
  54. *
  55. * @returns {void}
  56. * @protected
  57. */
  58. _reconnectNow() {
  59. // FIXME: In future we should dispatch an action here that will result
  60. // in reload.
  61. APP.ConferenceUrl.reload();
  62. }
  63. /**
  64. * Abstract method which should be used by subclasses to provide the overlay
  65. * content.
  66. *
  67. * @returns {ReactElement|null}
  68. * @protected
  69. */
  70. _renderOverlayContent() {
  71. return null;
  72. }
  73. }