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.

OverlayFrame.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* global interfaceConfig */
  2. import PropTypes from 'prop-types';
  3. import React, { Component } from 'react';
  4. /**
  5. * Implements a React {@link Component} for the frame of the overlays.
  6. */
  7. export default class OverlayFrame extends Component {
  8. /**
  9. * OverlayFrame component's property types.
  10. *
  11. * @static
  12. */
  13. static propTypes = {
  14. /**
  15. * The children components to be displayed into the overlay frame.
  16. */
  17. children: PropTypes.node.isRequired,
  18. /**
  19. * Indicates the css style of the overlay. If true, then lighter;
  20. * darker, otherwise.
  21. *
  22. * @type {boolean}
  23. */
  24. isLightOverlay: PropTypes.bool
  25. };
  26. /**
  27. * Initializes a new AbstractOverlay instance.
  28. *
  29. * @param {Object} props - The read-only properties with which the new
  30. * instance is to be initialized.
  31. * @public
  32. */
  33. constructor(props) {
  34. super(props);
  35. this.state = {
  36. /**
  37. * Indicates whether the filmstrip only mode is enabled or not.
  38. *
  39. * @type {boolean}
  40. */
  41. filmstripOnly:
  42. typeof interfaceConfig !== 'undefined'
  43. && interfaceConfig.filmStripOnly
  44. };
  45. }
  46. /**
  47. * Implements React's {@link Component#render()}.
  48. *
  49. * @inheritdoc
  50. * @returns {ReactElement|null}
  51. */
  52. render() {
  53. let containerClass = this.props.isLightOverlay
  54. ? 'overlay__container-light' : 'overlay__container';
  55. let contentClass = 'overlay__content';
  56. if (this.state.filmstripOnly) {
  57. containerClass += ' filmstrip-only';
  58. contentClass += ' filmstrip-only';
  59. }
  60. return (
  61. <div
  62. className = { containerClass }
  63. id = 'overlay'>
  64. <div className = { contentClass }>
  65. {
  66. this.props.children
  67. }
  68. </div>
  69. </div>
  70. );
  71. }
  72. }