Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] feat(MultistepDialog): allow custom next/back button props per step #4610

Conversation

tanmoyopenroot
Copy link
Contributor

Fixes #4579

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Provide a way to pass a callback to backButtonProps and nextButtonProps

const dialog = mount(
<MultistepDialog nextButtonProps={getNextButtonProps} isOpen={true} usePortal={false}>
<DialogStep id="one" title="Step 1" panel={<Panel />} />
<DialogStep id="two" title="Step 2" panel={<Panel />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, on second thought, I think a better API would look like this:

<DialogStep id="two" title="Step 2" panel={<Panel />} nextButtonProps={{ disabled: true }} />

since we're calling this.getDialogStepChildren() and accessing each DialogStep's props while rendering the buttons anyway... we can make the API more straightforward and ergonomic this way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making those changes

packages/core/src/components/dialog/multistepDialog.tsx Outdated Show resolved Hide resolved
packages/core/src/components/dialog/multistepDialog.tsx Outdated Show resolved Hide resolved
@adidahiya adidahiya changed the title [MultistepDialog] feat: pass callback to buttonprops [core] feat(MultistepDialog): allow custom next/back button props per step Apr 7, 2021
@adidahiya adidahiya merged commit 4a42215 into palantir:develop Apr 7, 2021
@tanmoyopenroot tanmoyopenroot deleted the tanmoyopenroot/4579-pass-callback-to-buttonprops branch April 8, 2021 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add different nextButtonProps for each Dialog in MultistepDialog
2 participants