Skip to content

Commit

Permalink
fix(components/TotalLayout): rename TotalLayout property stepNumberFo…
Browse files Browse the repository at this point in the history
…rDraftSave to minStepNumberForDraftSave
  • Loading branch information
paola-p committed Dec 4, 2023
1 parent 15b0d3f commit 26531bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/layout/TotalLayout/TotalLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TotalLayout = ({
stepsInfo,
activeStep = 0,
setActiveStep = () => {},
stepNumberForDraftSave,
minStepNumberForDraftSave,
onSave,
footerActionsLabels,
footerFinalActions,
Expand Down Expand Up @@ -113,7 +113,7 @@ const TotalLayout = ({
onNext={() => validateAndAct(handleNext)}
finalActions={finalActions}
footerActionsLabels={footerActionsLabels}
stepNumberForDraftSave={stepNumberForDraftSave}
minStepNumberForDraftSave={minStepNumberForDraftSave}
onSave={() => validateAndAct(onSave)}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ const Template = () => {
Steps={Steps}
footerActionsLabels={footerActionsLabels}
footerFinalActions={footerFinalActions}
// Pass the index of the step from wich a draft can be save. Don't pass the prop when no save functionality is needed
stepNumberForDraftSave={1}
minStepNumberForDraftSave={1}
onSave={handleOnSave}
/>
</Box>
Expand Down
13 changes: 7 additions & 6 deletions packages/components/src/layout/TotalLayout/TotalLayoutFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TotalLayoutFooter = ({
onNext,
finalActions,
footerActionsLabels,
stepNumberForDraftSave,
minStepNumberForDraftSave,
onSave,
}) => {
const { classes } = TotalLayoutFooterStyles(
Expand Down Expand Up @@ -56,11 +56,12 @@ const TotalLayoutFooter = ({
<div></div>
<Stack direction="row" spacing={2} noFlex>
{/* SAVE? */}
{!Number.isNaN(stepNumberForDraftSave) && activeStep >= stepNumberForDraftSave && (
<Button variant="link" onClick={onSave}>
{footerActionsLabels.save}
</Button>
)}
{!Number.isNaN(minStepNumberForDraftSave) &&
activeStep >= minStepNumberForDraftSave && (
<Button variant="link" onClick={onSave}>
{footerActionsLabels.save}
</Button>
)}
{/* NEXT OR FINAL ACTIONS */}
{renderFinalActions()}
</Stack>
Expand Down

0 comments on commit 26531bc

Please sign in to comment.