import PropTypes from 'prop-types';
import React from 'react';

import MediaImage from '../../../../elements/MediaImage';

/* Interface */
const propTypes = {
  /** Media ID of file */
  id: PropTypes.number,
};

/**
 * Renders content from the `storyshare/image` block using item
 * @private
 * @param {Object} props - React component props.
 * @returns {Object} React element if id is provided.
 */
export const Image = ({ id }) => {
  if (!id) {
    return null;
  }

  return <MediaImage id={ id } width={ 640 } />;
};

Image.propTypes = propTypes;

export default Image;
