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
2017-01-10 22:23:22 -02:00
export default function ImagePreview({ value, getAsset }) {
return (<div style={previewStyle}>
{ value ?
<img
2017-01-10 22:23:22 -02:00
src={getAsset(value)}
style={imagePreviewStyle}
role="presentation"
/>
: null}
</div>);
2016-05-30 16:55:32 -07:00
}
ImagePreview.propTypes = {
2017-01-10 22:23:22 -02:00
getAsset: PropTypes.func.isRequired,
value: PropTypes.node,
};