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(Dialog): modernise visuals, body & footer components #5753

Merged
merged 12 commits into from
Jan 10, 2023
Prev Previous commit
Next Next commit
Deprecate MSD class, fix tests
adidahiya committed Jan 10, 2023
commit e25c1ffdc6fe9c96f1fb2ccc37e0dcc111da0d32
1 change: 1 addition & 0 deletions packages/core/src/common/classes.ts
Original file line number Diff line number Diff line change
@@ -200,6 +200,7 @@ export const MULTISTEP_DIALOG = `${NS}-multistep-dialog`;
export const MULTISTEP_DIALOG_PANELS = `${MULTISTEP_DIALOG}-panels`;
export const MULTISTEP_DIALOG_LEFT_PANEL = `${MULTISTEP_DIALOG}-left-panel`;
export const MULTISTEP_DIALOG_RIGHT_PANEL = `${MULTISTEP_DIALOG}-right-panel`;
/** @deprecated use `Classes.DIALOG_FOOTER` instead */
export const MULTISTEP_DIALOG_FOOTER = `${MULTISTEP_DIALOG}-footer`;
Copy link
Contributor

Choose a reason for hiding this comment

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

this is part of the public API, so unfortunately we can't remove it so easily in this PR. we'll have to keep this constant here and continue adding the class name to the DOM in packages/core/src/components/dialog/multistepDialog.tsx on L220 (this will also fix the failing tests in this PR), but we can remove its Sass styles and rely on a new class name for the updated styling.

export const MULTISTEP_DIALOG_NAV_TOP = `${MULTISTEP_DIALOG}-nav-top`;
export const MULTISTEP_DIALOG_NAV_RIGHT = `${MULTISTEP_DIALOG}-nav-right`;
7 changes: 6 additions & 1 deletion packages/core/src/components/dialog/multistepDialog.tsx
Original file line number Diff line number Diff line change
@@ -217,7 +217,12 @@ export class MultistepDialog extends AbstractPureComponent2<MultistepDialogProps
const maybeCloseButton = !isFooterCloseButtonVisible ? undefined : (
<DialogStepButton text="Close" onClick={onClose} {...closeButtonProps} />
);
return <DialogFooter actions={this.renderButtons()}>{maybeCloseButton}</DialogFooter>;
return (
// eslint-disable-next-line deprecation/deprecation -- need to keep adding this class for backcompat, can be removed in next major version
<DialogFooter className={Classes.MULTISTEP_DIALOG_FOOTER} actions={this.renderButtons()}>
{maybeCloseButton}
</DialogFooter>
);
}

private renderButtons() {
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ describe("<MultistepDialog>", () => {
Classes.DIALOG_STEP_TITLE,
Classes.DIALOG_FOOTER_ACTIONS,
].forEach(className => {
assert.lengthOf(dialog.find(`.${className}`), 1, `missing ${className}`);
assert.lengthOf(dialog.find(`.${className}`).hostNodes(), 1, `missing ${className}`);
});
dialog.unmount();
});