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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* global $, APP */
  2. import React, { Component } from 'react';
  3. /**
  4. * Implements an abstract React Component for overlay - the components which
  5. * are 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 - lighter and
  22. * darker otherwise.
  23. * @type {boolean}
  24. */
  25. isLightOverlay: false
  26. };
  27. }
  28. /**
  29. * Abstract method which should be used by subclasses to provide the overlay
  30. * content.
  31. *
  32. * @returns {ReactElement|null}
  33. * @protected
  34. */
  35. _renderOverlayContent() {
  36. return null;
  37. }
  38. /**
  39. * This method is executed when comonent is mounted.
  40. *
  41. * @inheritdoc
  42. * @returns {void}
  43. */
  44. componentDidMount() {
  45. // XXX Temporary solution until we add React translation.
  46. APP.translation.translateElement($('#overlay'));
  47. }
  48. /**
  49. * Reloads the page.
  50. *
  51. * @returns {void}
  52. * @protected
  53. */
  54. _reconnectNow() {
  55. // FIXME: In future we should dispatch an action here that will result
  56. // in reload.
  57. APP.ConferenceUrl.reload();
  58. }
  59. /**
  60. * Implements React's {@link Component#render()}.
  61. *
  62. * @inheritdoc
  63. * @returns {ReactElement|null}
  64. */
  65. render() {
  66. const containerClass = this.state.isLightOverlay
  67. ? 'overlay__container-light' : 'overlay__container';
  68. return (
  69. <div
  70. className = { containerClass }
  71. id = 'overlay'>
  72. <div className = 'overlay__content'>
  73. { this._renderOverlayContent() }
  74. </div>
  75. </div>
  76. );
  77. }
  78. }