update style across the project
The eslint updates require style changes in all components.
This commit is contained in:
parent
7959f2a563
commit
4fa71cede8
56 changed files with 5973 additions and 5177 deletions
|
|
@ -4,45 +4,62 @@ import { FormSpy } from '@data-driven-forms/react-form-renderer';
|
|||
import WizardContext from '@data-driven-forms/react-form-renderer/wizard-context';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const CustomButtons = ({ buttonLabels: { cancel, submit, back }}) => {
|
||||
const [ isSaving, setIsSaving ] = useState(false);
|
||||
const { handlePrev, formOptions } = useContext(WizardContext);
|
||||
return <FormSpy>
|
||||
{() => (
|
||||
<React.Fragment>
|
||||
<Button
|
||||
variant="primary"
|
||||
type="button"
|
||||
isDisabled={ !formOptions.valid || formOptions.getState().validating || isSaving }
|
||||
isLoading={ isSaving }
|
||||
onClick={ () => {
|
||||
formOptions.onSubmit({
|
||||
values: formOptions.getState().values,
|
||||
setIsSaving
|
||||
});
|
||||
} }>
|
||||
{ isSaving ? 'Creating image' : submit}
|
||||
</Button>
|
||||
<Button type="button" variant="secondary" onClick={ handlePrev } isDisabled={ isSaving }>
|
||||
{back}
|
||||
</Button>
|
||||
<div className="pf-c-wizard__footer-cancel">
|
||||
<Button type="button" variant="link" onClick={ formOptions.onCancel } isDisabled={ isSaving }>
|
||||
{cancel}
|
||||
</Button>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</FormSpy>;
|
||||
const CustomButtons = ({ buttonLabels: { cancel, submit, back } }) => {
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const { handlePrev, formOptions } = useContext(WizardContext);
|
||||
return (
|
||||
<FormSpy>
|
||||
{() => (
|
||||
<React.Fragment>
|
||||
<Button
|
||||
variant="primary"
|
||||
type="button"
|
||||
isDisabled={
|
||||
!formOptions.valid ||
|
||||
formOptions.getState().validating ||
|
||||
isSaving
|
||||
}
|
||||
isLoading={isSaving}
|
||||
onClick={() => {
|
||||
formOptions.onSubmit({
|
||||
values: formOptions.getState().values,
|
||||
setIsSaving,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{isSaving ? 'Creating image' : submit}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
onClick={handlePrev}
|
||||
isDisabled={isSaving}
|
||||
>
|
||||
{back}
|
||||
</Button>
|
||||
<div className="pf-c-wizard__footer-cancel">
|
||||
<Button
|
||||
type="button"
|
||||
variant="link"
|
||||
onClick={formOptions.onCancel}
|
||||
isDisabled={isSaving}
|
||||
>
|
||||
{cancel}
|
||||
</Button>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</FormSpy>
|
||||
);
|
||||
};
|
||||
|
||||
CustomButtons.propTypes = {
|
||||
buttonLabels: PropTypes.shape({
|
||||
cancel: PropTypes.node,
|
||||
submit: PropTypes.node,
|
||||
back: PropTypes.node,
|
||||
}),
|
||||
isSaving: PropTypes.bool
|
||||
buttonLabels: PropTypes.shape({
|
||||
cancel: PropTypes.node,
|
||||
submit: PropTypes.node,
|
||||
back: PropTypes.node,
|
||||
}),
|
||||
isSaving: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default CustomButtons;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue