2017-03-30 16:58:31 +00:00
|
|
|
import React, { Component } from 'react';
|
2017-04-06 16:45:36 +00:00
|
|
|
|
2017-03-30 16:58:31 +00:00
|
|
|
import DesktopSourcePreview from './DesktopSourcePreview';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* React component for showing a grid of DesktopSourcePreviews.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
|
|
|
class DesktopPickerPane extends Component {
|
|
|
|
/**
|
|
|
|
* DesktopPickerPane component's property types.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static propTypes = {
|
|
|
|
/**
|
|
|
|
* The handler to be invoked when a DesktopSourcePreview is clicked.
|
|
|
|
*/
|
|
|
|
onClick: React.PropTypes.func,
|
|
|
|
|
|
|
|
/**
|
2017-04-06 16:45:36 +00:00
|
|
|
* The handler to be invoked when a DesktopSourcePreview is double
|
|
|
|
* clicked.
|
2017-03-30 16:58:31 +00:00
|
|
|
*/
|
|
|
|
onDoubleClick: React.PropTypes.func,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The id of the DesktopCapturerSource that is currently selected.
|
|
|
|
*/
|
|
|
|
selectedSourceId: React.PropTypes.string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An array of DesktopCapturerSources.
|
|
|
|
*/
|
|
|
|
sources: React.PropTypes.array,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The source type of the DesktopCapturerSources to display.
|
|
|
|
*/
|
|
|
|
type: React.PropTypes.string
|
2017-06-02 02:01:50 +00:00
|
|
|
};
|
2017-03-30 16:58:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2017-04-06 16:45:36 +00:00
|
|
|
const {
|
|
|
|
onClick,
|
|
|
|
onDoubleClick,
|
|
|
|
selectedSourceId,
|
|
|
|
sources,
|
|
|
|
type
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const classNames
|
|
|
|
= `desktop-picker-pane default-scrollbar source-type-${type}`;
|
|
|
|
const previews
|
|
|
|
= sources.map(
|
|
|
|
source =>
|
|
|
|
<DesktopSourcePreview
|
|
|
|
key = { source.id }
|
|
|
|
onClick = { onClick }
|
|
|
|
onDoubleClick = { onDoubleClick }
|
|
|
|
selected = { source.id === selectedSourceId }
|
|
|
|
source = { source } />);
|
2017-03-30 16:58:31 +00:00
|
|
|
|
|
|
|
return (
|
2017-04-06 16:45:36 +00:00
|
|
|
<div className = { classNames }>
|
2017-03-30 16:58:31 +00:00
|
|
|
{ previews }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DesktopPickerPane;
|