dopry/netlify-cms

View on GitHub
src/components/Widgets/ImagePreview.js

Summary

Maintainability
A
0 mins
Test Coverage
import PropTypes from 'prop-types';
import React from 'react';
import previewStyle, { imagePreviewStyle } from './defaultPreviewStyle';

export default function ImagePreview({ value, getAsset }) {
  return (<div style={previewStyle}>
    { value ?
      <img
        src={getAsset(value)}
        style={imagePreviewStyle}
        role="presentation"
      />
      : null}
  </div>);
}

ImagePreview.propTypes = {
  getAsset: PropTypes.func.isRequired,
  value: PropTypes.node,
};