static-cms/src/components/Widgets/ImagePreview.js

20 lines
461 B
JavaScript
Raw Normal View History

import React, { PropTypes } from 'react';
import previewStyle, { imagePreviewStyle } from './defaultPreviewStyle';
2016-05-30 16:55:32 -07:00
export default function ImagePreview({ value, getMedia }) {
return (<div style={previewStyle}>
{ value ?
<img
src={getMedia(value)}
style={imagePreviewStyle}
role="presentation"
/>
: null}
</div>);
2016-05-30 16:55:32 -07:00
}
ImagePreview.propTypes = {
getMedia: PropTypes.func.isRequired,
value: PropTypes.node,
};