[Glitch] Improved media modal

Port 4e929b2d17 to glitch-soc
This commit is contained in:
Thibaut Girka
2018-04-08 23:15:25 +02:00
parent 0b86ec4e7f
commit 87071d9e81
8 changed files with 330 additions and 93 deletions

View File

@@ -11,6 +11,7 @@ export default class ExtendedVideoPlayer extends React.PureComponent {
time: PropTypes.number,
controls: PropTypes.bool.isRequired,
muted: PropTypes.bool.isRequired,
onClick: PropTypes.func,
};
handleLoadedData = () => {
@@ -31,6 +32,12 @@ export default class ExtendedVideoPlayer extends React.PureComponent {
this.video = c;
}
handleClick = e => {
e.stopPropagation();
const handler = this.props.onClick;
if (handler) handler();
}
render () {
const { src, muted, controls, alt } = this.props;
@@ -46,6 +53,7 @@ export default class ExtendedVideoPlayer extends React.PureComponent {
muted={muted}
controls={controls}
loop={!controls}
onClick={this.handleClick}
/>
</div>
);