lbry-desktop/src/renderer/component/video/internal/play-button.jsx

27 lines
697 B
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
import React from 'react';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
type Props = {
2018-05-16 20:32:25 +02:00
play: () => void,
2018-03-26 23:32:43 +02:00
isLoading: boolean,
mediaType: string,
fileInfo: ?{},
};
class VideoPlayButton extends React.PureComponent<Props> {
render() {
2018-05-16 20:32:25 +02:00
const { fileInfo, mediaType, isLoading, play } = this.props;
2018-03-26 23:32:43 +02:00
const disabled = isLoading || fileInfo === undefined;
const doesPlayback = ['audio', 'video'].indexOf(mediaType) !== -1;
const icon = doesPlayback ? 'Play' : 'Folder';
const label = doesPlayback ? 'Play' : 'View';
return (
2018-05-21 22:30:00 +02:00
<Button button="primary" disabled={disabled} label={label} icon={icon} onClick={play} />
);
}
}
export default VideoPlayButton;