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.web.js 2.1KB

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