2016-05-03 06:42:54 +08:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import styles from './styles.scss';
|
2016-05-04 04:40:46 +08:00
|
|
|
import { FormattedMessage, FormattedDate } from 'react-intl';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
content: PropTypes.element.isRequired,
|
|
|
|
overlay: PropTypes.element,
|
|
|
|
};
|
2016-05-03 06:42:54 +08:00
|
|
|
|
|
|
|
export default class Media extends Component {
|
2016-05-04 04:40:46 +08:00
|
|
|
renderContent() {
|
|
|
|
const { content } = this.props;
|
|
|
|
|
2016-05-31 07:10:01 +08:00
|
|
|
return content;
|
2016-05-04 04:40:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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>
|
2016-05-04 04:40:46 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className={styles.container}>
|
|
|
|
{this.props.children}
|
|
|
|
{this.renderContent()}
|
|
|
|
{this.renderOverlay()}
|
2016-05-03 06:42:54 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-05-04 04:40:46 +08:00
|
|
|
|
|
|
|
Media.propTypes = propTypes;
|