refactor: convert function expressions to declarations (#4926)
This commit is contained in:
committed by
GitHub
parent
c0236536dd
commit
141a2eba56
@ -4,20 +4,24 @@ import { List } from 'immutable';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { WidgetPreviewContainer } from 'netlify-cms-ui-default';
|
||||
|
||||
const ListPreview = ({ values }) => (
|
||||
<ul>
|
||||
{values.map((value, idx) => (
|
||||
<li key={idx}>{value}</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
function ListPreview({ values }) {
|
||||
return (
|
||||
<ul>
|
||||
{values.map((value, idx) => (
|
||||
<li key={idx}>{value}</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
const SelectPreview = ({ value }) => (
|
||||
<WidgetPreviewContainer>
|
||||
{value && (List.isList(value) ? <ListPreview values={value} /> : value)}
|
||||
{!value && null}
|
||||
</WidgetPreviewContainer>
|
||||
);
|
||||
function SelectPreview({ value }) {
|
||||
return (
|
||||
<WidgetPreviewContainer>
|
||||
{value && (List.isList(value) ? <ListPreview values={value} /> : value)}
|
||||
{!value && null}
|
||||
</WidgetPreviewContainer>
|
||||
);
|
||||
}
|
||||
|
||||
SelectPreview.propTypes = {
|
||||
value: PropTypes.oneOfType([PropTypes.string, ImmutablePropTypes.list]),
|
||||
|
@ -2,13 +2,15 @@ import controlComponent from './SelectControl';
|
||||
import previewComponent from './SelectPreview';
|
||||
import schema from './schema';
|
||||
|
||||
const Widget = (opts = {}) => ({
|
||||
name: 'select',
|
||||
controlComponent,
|
||||
previewComponent,
|
||||
schema,
|
||||
...opts,
|
||||
});
|
||||
function Widget(opts = {}) {
|
||||
return {
|
||||
name: 'select',
|
||||
controlComponent,
|
||||
previewComponent,
|
||||
schema,
|
||||
...opts,
|
||||
};
|
||||
}
|
||||
|
||||
export const NetlifyCmsWidgetSelect = { Widget, controlComponent, previewComponent };
|
||||
export default NetlifyCmsWidgetSelect;
|
||||
|
Reference in New Issue
Block a user