bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/media/component.jsx

55 lines
1.3 KiB
React
Raw Normal View History

import React, { Component } from 'react';
import PropTypes from 'prop-types';
2018-04-10 02:28:54 +08:00
import cx from 'classnames';
import VideoProviderContainer from '/imports/ui/components/video-provider/container';
2018-01-08 14:17:18 +08:00
import { styles } from './styles';
const propTypes = {
children: PropTypes.element.isRequired,
2018-04-10 02:28:54 +08:00
floatingOverlay: PropTypes.bool,
hideOverlay: PropTypes.bool,
};
2016-05-03 06:42:54 +08:00
2017-10-11 06:08:51 +08:00
const defaultProps = {
2018-04-10 02:28:54 +08:00
floatingOverlay: false,
hideOverlay: true,
2017-10-11 06:08:51 +08:00
};
2016-05-03 06:42:54 +08:00
export default class Media extends Component {
componentWillUpdate() {
window.dispatchEvent(new Event('resize'));
}
render() {
const {
swapLayout, floatingOverlay, hideOverlay, disableVideo,
} = this.props;
2018-04-10 02:28:54 +08:00
const contentClassName = cx({
[styles.content]: true,
});
const overlayClassName = cx({
[styles.overlay]: true,
[styles.hideOverlay]: hideOverlay,
[styles.floatingOverlay]: floatingOverlay,
});
return (
<div className={styles.container}>
<div className={!swapLayout ? contentClassName : overlayClassName}>
{this.props.children}
</div>
<div className={!swapLayout ? overlayClassName : contentClassName}>
{ !disableVideo ? <VideoProviderContainer /> : null }
</div>
2016-05-03 06:42:54 +08:00
</div>
);
}
}
Media.propTypes = propTypes;
2017-10-11 06:08:51 +08:00
Media.defaultProps = defaultProps;