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

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