'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = BlobImage;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _blobHelpers = require('../../helpers/blobHelpers');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var propTypes = {
  csid: _react.PropTypes.string.isRequired,
  derivative: _react.PropTypes.string
};

var defaultProps = {
  derivative: 'Thumbnail'
};

var contextTypes = {
  config: _react.PropTypes.object.isRequired
};

function BlobImage(props, context) {
  var csid = props.csid,
      derivative = props.derivative;
  var config = context.config;


  var url = (0, _blobHelpers.getDerivativeUrl)(config, csid, derivative);

  return (
    // TODO: Is there any alt text that would be helpful? Leaving it off for now.
    /* eslint-disable jsx-a11y/img-has-alt */
    _react2.default.createElement('img', { src: url })
    /* eslint-enable jsx-a11y/img-has-alt */

  );
}

BlobImage.propTypes = propTypes;
BlobImage.defaultProps = defaultProps;
BlobImage.contextTypes = contextTypes;