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