migrate file and image widgets
This commit is contained in:
22
packages/netlify-cms-widget-image/src/ImagePreview.js
Normal file
22
packages/netlify-cms-widget-image/src/ImagePreview.js
Normal file
@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled from 'react-emotion';
|
||||
import { WidgetPreviewContainer } from 'netlify-cms-ui-default';
|
||||
|
||||
const Image = styled.img`
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
`
|
||||
|
||||
const ImagePreview = ({ value, getAsset }) => (
|
||||
<WidgetPreviewContainer>
|
||||
{ value ? <Image src={getAsset(value)} role="presentation"/> : null}
|
||||
</WidgetPreviewContainer>
|
||||
);
|
||||
|
||||
ImagePreview.propTypes = {
|
||||
getAsset: PropTypes.func.isRequired,
|
||||
value: PropTypes.node,
|
||||
};
|
||||
|
||||
export default ImagePreview;
|
4
packages/netlify-cms-widget-image/src/index.js
Normal file
4
packages/netlify-cms-widget-image/src/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
import { withFileControl } from 'netlify-cms-widget-file';
|
||||
|
||||
export const ImageControl = withFileControl({ forImage: true });
|
||||
export ImagePreview from './ImagePreview';
|
Reference in New Issue
Block a user