import React from 'react'; import PropTypes from 'prop-types'; import { get } from 'lodash'; import { withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { Inputs as Input } from '@buffetjs/custom'; import { BackHeader, PluginHeader, LoadingIndicatorPage, } from 'strapi-helper-plugin'; import Block from '../Block'; import Container from '../Container'; import SectionTitle from '../SectionTitle'; import Separator from '../Separator'; const SettingsViewWrapper = ({ children, getSelectOptions, history: { goBack }, inputs, isLoading, modifiedData, onChange, onSubmit, pluginHeaderProps, }) => { if (isLoading) { return ; } return ( <>
{inputs.map(input => { return ( {label => (
{description => ( )}
)}
); })}
{children}
); }; SettingsViewWrapper.defaultProps = { getSelectOptions: () => {}, inputs: [], modifiedData: {}, onSubmit: () => {}, pluginHeaderProps: { actions: [], description: { id: 'app.utils.defaultMessage', }, title: { id: 'app.utils.defaultMessage', values: {}, }, }, }; SettingsViewWrapper.propTypes = { children: PropTypes.node.isRequired, getSelectOptions: PropTypes.func, history: PropTypes.shape({ goBack: PropTypes.func.isRequired, }).isRequired, inputs: PropTypes.array, isLoading: PropTypes.bool.isRequired, modifiedData: PropTypes.object, onChange: PropTypes.func.isRequired, onSubmit: PropTypes.func, pluginHeaderProps: PropTypes.shape({ actions: PropTypes.array, description: PropTypes.shape({ id: PropTypes.string, }), title: PropTypes.shape({ id: PropTypes.string, values: PropTypes.object, }), }), }; export default withRouter(SettingsViewWrapper);