refactor: convert function expressions to declarations (#4926)
This commit is contained in:
committed by
GitHub
parent
c0236536dd
commit
141a2eba56
@ -30,9 +30,13 @@ function FileContent(props) {
|
||||
return <FileLink key={value} path={value} href={getAsset(value, field)} />;
|
||||
}
|
||||
|
||||
const FilePreview = props => (
|
||||
<WidgetPreviewContainer>{props.value ? <FileContent {...props} /> : null}</WidgetPreviewContainer>
|
||||
);
|
||||
function FilePreview(props) {
|
||||
return (
|
||||
<WidgetPreviewContainer>
|
||||
{props.value ? <FileContent {...props} /> : null}
|
||||
</WidgetPreviewContainer>
|
||||
);
|
||||
}
|
||||
|
||||
FilePreview.propTypes = {
|
||||
getAsset: PropTypes.func.isRequired,
|
||||
|
@ -3,13 +3,16 @@ import previewComponent from './FilePreview';
|
||||
import schema from './schema';
|
||||
|
||||
const controlComponent = withFileControl();
|
||||
const Widget = (opts = {}) => ({
|
||||
name: 'file',
|
||||
controlComponent,
|
||||
previewComponent,
|
||||
schema,
|
||||
...opts,
|
||||
});
|
||||
|
||||
function Widget(opts = {}) {
|
||||
return {
|
||||
name: 'file',
|
||||
controlComponent,
|
||||
previewComponent,
|
||||
schema,
|
||||
...opts,
|
||||
};
|
||||
}
|
||||
|
||||
export const NetlifyCmsWidgetFile = { Widget, controlComponent, previewComponent, withFileControl };
|
||||
export default NetlifyCmsWidgetFile;
|
||||
|
@ -34,7 +34,9 @@ const StyledImage = styled.img`
|
||||
object-fit: contain;
|
||||
`;
|
||||
|
||||
const Image = props => <StyledImage role="presentation" {...props} />;
|
||||
function Image(props) {
|
||||
return <StyledImage role="presentation" {...props} />;
|
||||
}
|
||||
|
||||
const SortableImage = SortableElement(({ itemValue, getAsset, field }) => {
|
||||
return (
|
||||
|
Reference in New Issue
Block a user