Files
jitsi-meet/react/features/desktop-picker/components/DesktopPickerPane.js
Lyubo Marinov dfebd692f3 eslint 4.8.0
ESLint 4.8.0 discovers a lot of error related to formatting. While I
tried to fix as many of them as possible, a portion of them actually go
against our coding style. In such a case, I've disabled the indent rule
which effectively leaves it as it was before ESLint 4.8.0.

Additionally, remove jshint because it's becoming a nuisance with its
lack of understanding of ES2015+.
2017-10-02 18:12:38 -05:00

84 lines
2.1 KiB
JavaScript

import PropTypes from 'prop-types';
import React, { Component } from 'react';
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: PropTypes.func,
/**
* The handler to be invoked when a DesktopSourcePreview is double
* clicked.
*/
onDoubleClick: PropTypes.func,
/**
* The id of the DesktopCapturerSource that is currently selected.
*/
selectedSourceId: PropTypes.string,
/**
* An array of DesktopCapturerSources.
*/
sources: PropTypes.array,
/**
* The source type of the DesktopCapturerSources to display.
*/
type: PropTypes.string
};
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const {
onClick,
onDoubleClick,
selectedSourceId,
sources,
type
} = this.props;
const classNames
= `desktop-picker-pane default-scrollbar source-type-${type}`;
const previews
= sources.map(
source =>
// eslint-disable-next-line react/jsx-wrap-multilines
<DesktopSourcePreview
key = { source.id }
onClick = { onClick }
onDoubleClick = { onDoubleClick }
selected = { source.id === selectedSourceId }
source = { source }
type = { type } />);
return (
<div className = { classNames }>
{ previews }
</div>
);
}
}
export default DesktopPickerPane;