import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { styles } from './styles'; const propTypes = { content: PropTypes.element.isRequired, overlay: PropTypes.element, }; const defaultProps = { overlay: null, }; export default class Media extends Component { renderContent() { const { content } = this.props; return content; } renderOverlay() { const { overlay } = this.props; if (overlay) { return (
{overlay}
); } return false; } render() { return (
{this.props.children} {this.renderContent()} {this.renderOverlay()}
); } } Media.propTypes = propTypes; Media.defaultProps = defaultProps;