-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce1cc17
commit d9ab452
Showing
5 changed files
with
147 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import MultiStepFooter from 'web/components/dialog/multistepfooter'; | ||
import DialogFooter from 'web/components/dialog/twobuttonfooter'; | ||
import PropTypes from 'web/utils/proptypes'; | ||
|
||
const SaveDialogFooter = ({ | ||
multiStep, | ||
isLoading, | ||
prevDisabled, | ||
nextDisabled, | ||
buttonTitle, | ||
currentStep, | ||
setCurrentStep, | ||
onClose, | ||
handleSaveClick, | ||
}) => { | ||
return multiStep > 0 ? ( | ||
<MultiStepFooter | ||
loading={isLoading} | ||
prevDisabled={prevDisabled} | ||
nextDisabled={nextDisabled} | ||
rightButtonTitle={buttonTitle} | ||
onNextButtonClick={() => | ||
setCurrentStep(currentStep < multiStep ? currentStep + 1 : currentStep) | ||
} | ||
onLeftButtonClick={onClose} | ||
onPreviousButtonClick={() => | ||
setCurrentStep(currentStep > 0 ? currentStep - 1 : currentStep) | ||
} | ||
onRightButtonClick={handleSaveClick} | ||
/> | ||
) : ( | ||
<DialogFooter | ||
isLoading={isLoading} | ||
rightButtonTitle={buttonTitle} | ||
onLeftButtonClick={onClose} | ||
onRightButtonClick={handleSaveClick} | ||
/> | ||
); | ||
}; | ||
|
||
SaveDialogFooter.propTypes = { | ||
multiStep: PropTypes.number.isRequired, | ||
isLoading: PropTypes.bool.isRequired, | ||
prevDisabled: PropTypes.bool.isRequired, | ||
nextDisabled: PropTypes.bool.isRequired, | ||
buttonTitle: PropTypes.string.isRequired, | ||
currentStep: PropTypes.number.isRequired, | ||
setCurrentStep: PropTypes.func.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
handleSaveClick: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default SaveDialogFooter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.