您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OverlayFrame.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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:
  41. typeof interfaceConfig !== 'undefined'
  42. && interfaceConfig.filmStripOnly
  43. };
  44. }
  45. /**
  46. * Implements React's {@link Component#render()}.
  47. *
  48. * @inheritdoc
  49. * @returns {ReactElement|null}
  50. */
  51. render() {
  52. let containerClass = this.props.isLightOverlay
  53. ? 'overlay__container-light' : 'overlay__container';
  54. let contentClass = 'overlay__content';
  55. if (this.state.filmstripOnly) {
  56. containerClass += ' filmstrip-only';
  57. contentClass += ' filmstrip-only';
  58. }
  59. return (
  60. <div
  61. className = { containerClass }
  62. id = 'overlay'>
  63. <div className = { contentClass }>
  64. {
  65. this.props.children
  66. }
  67. </div>
  68. </div>
  69. );
  70. }
  71. }