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

DesktopPickerPane.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import React, { Component } from 'react';
  2. import DesktopSourcePreview from './DesktopSourcePreview';
  3. /**
  4. * React component for showing a grid of DesktopSourcePreviews.
  5. *
  6. * @extends Component
  7. */
  8. class DesktopPickerPane extends Component {
  9. /**
  10. * DesktopPickerPane component's property types.
  11. *
  12. * @static
  13. */
  14. static propTypes = {
  15. /**
  16. * The handler to be invoked when a DesktopSourcePreview is clicked.
  17. */
  18. onClick: React.PropTypes.func,
  19. /**
  20. * The handler to be invoked when a DesktopSourcePreview is
  21. * double clicked.
  22. */
  23. onDoubleClick: React.PropTypes.func,
  24. /**
  25. * The id of the DesktopCapturerSource that is currently selected.
  26. */
  27. selectedSourceId: React.PropTypes.string,
  28. /**
  29. * An array of DesktopCapturerSources.
  30. */
  31. sources: React.PropTypes.array,
  32. /**
  33. * The source type of the DesktopCapturerSources to display.
  34. */
  35. type: React.PropTypes.string
  36. }
  37. /**
  38. * Implements React's {@link Component#render()}.
  39. *
  40. * @inheritdoc
  41. * @returns {ReactElement}
  42. */
  43. render() {
  44. const previews = this.props.sources.map(source =>
  45. <DesktopSourcePreview
  46. isSelected = { source.id === this.props.selectedSourceId }
  47. key = { source.id }
  48. onClick = { this.props.onClick }
  49. onDoubleClick = { this.props.onDoubleClick }
  50. source = { source } />
  51. );
  52. const classnames = 'desktop-picker-pane default-scrollbar '
  53. + `source-type-${this.props.type}`;
  54. return (
  55. <div className = { classnames }>
  56. { previews }
  57. </div>
  58. );
  59. }
  60. }
  61. export default DesktopPickerPane;