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

Refactor common dialog/drawer code into a base class #1801

Closed
wants to merge 17 commits into from

Conversation

m-akinc
Copy link
Contributor

@m-akinc m-akinc commented Feb 2, 2024

Pull Request

🀨 Rationale

Refactor to avoid duplication between dialog and drawer.

πŸ‘©β€πŸ’» Implementation

Created common base class DialogBase.

πŸ§ͺ Testing

Existing tests pass.

βœ… Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@m-akinc m-akinc requested a review from atmgrifter00 February 2, 2024 21:04
@m-akinc
Copy link
Contributor Author

m-akinc commented Feb 2, 2024

@atmgrifter00 would you mind buddying this?

@m-akinc m-akinc marked this pull request as ready for review February 2, 2024 23:35
@rajsite
Copy link
Member

rajsite commented Feb 2, 2024

Adding @mollykreis to take a look since they are familiar with original code and the issue being addressed

@rajsite rajsite requested a review from mollykreis February 2, 2024 23:45
packages/nimble-components/src/dialog-base/index.ts Outdated Show resolved Hide resolved
packages/nimble-components/src/dialog/styles.ts Outdated Show resolved Hide resolved
packages/nimble-components/src/dialog/tests/dialog.spec.ts Outdated Show resolved Hide resolved
packages/nimble-components/src/drawer/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jattasNI jattasNI left a comment

Choose a reason for hiding this comment

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

I didn't get a chance to review before going out of office. If other reviewers approve then you don't need to wait for me.

@m-akinc m-akinc requested a review from jattasNI February 13, 2024 18:33
@m-akinc m-akinc changed the title Make dialog and drawer more resilient to upcoming CloseWatcher API Refactor common dialog/drawer code into a base class Feb 20, 2024
@m-akinc m-akinc requested a review from rajsite February 20, 2024 23:33
Copy link
Contributor

@jattasNI jattasNI left a comment

Choose a reason for hiding this comment

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

@m-akinc FYI there are some lint errors but otherwise looks good!

@m-akinc m-akinc requested a review from rajsite February 22, 2024 19:06
@m-akinc m-akinc requested a review from rajsite February 22, 2024 23:40
@m-akinc m-akinc enabled auto-merge (squash) February 23, 2024 00:35
@rajsite rajsite disabled auto-merge February 26, 2024 18:22
this.startClosing(reason);
}

/**
Copy link
Member

Choose a reason for hiding this comment

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

The responsibilities of cancel and close handlers don't seem quite right. I think similar to some previous commits they seem over coupled to specific workflows. Modal instances like drawer calling "super.cancelHandler" to start the transition to Closing and check the preventDismiss state seems like unclear responsibilities for a method called "cancelHandler".

Looking at it again I also have a more general question of why are we not designing animations into the Modal base class. I'm actually wondering now if it is really intentional that the dialog has no animations. Seems like even short, fast animations would be useful for all modals.

Some directions:

  • We can continue to discuss and iterate on the responsibilities of the base class, including seeing if animation responsibilities make more sense there, it probably makes sense to discuss it first to prevent review cycles or continue the approach of aync comment and feedback if you want to keep going that way
  • We pause the refactor for now since we don't have a clear need for shared Modal base classes at the moment (I'm not aware of new modals we need to implement or if we want to share more behavior like animations across all the modals)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll de-prioritize and move to draft until I have new changes to review.

@m-akinc m-akinc marked this pull request as draft February 26, 2024 22:04
@rajsite
Copy link
Member

rajsite commented Jul 2, 2024

Closing the draft as unprioritized right now. Think it would be useful to reconsider if adding additional modal types / decide to share more functionality (i.e. animations for dialogs and drawers)

@rajsite rajsite closed this Jul 2, 2024
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.

5 participants