Closed curtismenmuir closed 4 years ago
Hi @curtismenmuir - Thanks for opening a PR and wanting to contribute to the project!
Removing activeStep
from the internal state of <ProgressSteps />
will break existing implementations of the project. The activeStep
prop hasn't been required to be set/incremented previously by the user for the buttons to work. So I think this needs to be implemented in a way that makes it compatible with existing functionality.
I will take a look at the other proposed changes to see if they make sense to include in the next release!
@colbymillerdev sorry, I didn't think about the buttons as I have used the new removeBtnRow
prop that I have added! Happy to remove the activeStep
change from PR if you are happy with other changes!
@colbymillerdev Could use componentWillUpdate and check if activeStep prop has changed:
componentWillUpdate(prevProps) {
if(prevProps.activeStep !== this.props.activeStep){
this.setActiveStep(this.props.activeStep);
}
}
Will update PR with example
PR updated so that activeStep prop is set in state, but it can be updated due to componentWillUpdate
function
@curtismenmuir Awesome, thanks for updating that! I'd rather not use componentWillUpdate
since it's been deprecated and will be removed in a future React release. We could try using the getSnapshotBeforeUpdate
lifecycle method instead.
Everything else is great, but I'd like to hold off on the hasFailures
functionality for now to give it more thought. Would you mind also updating the PR to remove that feature? Thanks!
@colbymillerdev Sorry, I have had a couple busy days. No worries, I will get those changes made tomorrow and will let you know when they are ready!
@curtismenmuir Awesome, sounds good!
@colbymillerdev I have been looking into getSnapshotBeforeUpdate
and I believe that this may only require updating componentWillUpdate
to componentDidUpdate
.
We could use getSnapshotBeforeUpdate
to feed into componentDidUpdate
but I believe there is no need as componentDidUpdate
also has access to prevProps
.
I have tested locally and all is working fine. What are your thoughts on this update?
@curtismenmuir Cool, that works for me! I'll test it out also to make sure everything works as expected.
@colbymillerdev Requested updates are ready for review. I have tested locally and looks good! Also updated PR description as per updates. Let me know if there is anything else you want me to update.
@curtismenmuir Looks good to me and got it merged in. Thanks again for making these changes!
Description
removeBtnRow
prop toProgressStep
so that the Buttons can be completely removedcomponentDidUpdate
function toProgressSteps
so thatactiveStep
prop can be used to programmatically update the current Step positionisComplete
prop toProgressSteps
so that a complete stage can be shown (AllProgressSteps
set to completed).completedLabelColor
prop so that Completed labels can be set differently to Disabled labelsNOTE: I am happy to split this up into separate PR's if needed -> I required all of the changes for a release at work.