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

52 lines
974 B
React
Raw Normal View History

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from './styles';
const propTypes = {
content: PropTypes.element.isRequired,
overlay: PropTypes.element,
};
2016-05-03 06:42:54 +08:00
2017-10-11 06:08:51 +08:00
const defaultProps = {
overlay: null,
};
2016-05-03 06:42:54 +08:00
export default class Media extends Component {
renderContent() {
const { content } = this.props;
return content;
}
renderOverlay() {
const { overlay } = this.props;
if (overlay) {
return (
<div className={styles.overlayWrapper}>
<div className={styles.overlayRatio}>
<div className={styles.overlay}>
{overlay}
</div>
</div>
2016-05-03 06:42:54 +08:00
</div>
);
}
return false;
}
render() {
return (
<div className={styles.container}>
{this.props.children}
{this.renderContent()}
{this.renderOverlay()}
2016-05-03 06:42:54 +08:00
</div>
);
}
}
Media.propTypes = propTypes;
2017-10-11 06:08:51 +08:00
Media.defaultProps = defaultProps;