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

ConfirmModal Improvement #525

Closed
wadjih-bencheikh18 opened this issue Jul 31, 2023 · 1 comment
Closed

ConfirmModal Improvement #525

wadjih-bencheikh18 opened this issue Jul 31, 2023 · 1 comment

Comments

@wadjih-bencheikh18
Copy link
Member

wadjih-bencheikh18 commented Jul 31, 2023

In our case, ConfirmModal contain only two buttons, the "Save" and "Cancel" buttons.
By passing the buttons data as an array to the ConfirmModal component, we can enhance its flexibility and reusability.

interfae ButtonsData{
  text: string;
  handle: ()=>void;
}

We can then utilize the updated ConfirmModal with the array of buttons in NMRium
https://github.com/cheminfo/nmrium/blob/05e40c0d1cdc1a58743b6d7bfbf7cac8ce7c998b/src/component/EventsTrackers/KeysListenerTracker.tsx#L118-L127

@wadjih-bencheikh18 wadjih-bencheikh18 changed the title ConfirmeModal Improvement ConfirmModal Improvement Aug 15, 2023
@stropitek
Copy link
Contributor

The problem with this approach is that we no longer have a standard way to display things. In the confirm modal we need consistency in how the confirm and the cancel button are displayed (order, style etc...).

For confirm modals which need more than 2 buttons, it's up to the project (NMRium) to define a special component which allow to handle the special case.

If we allow this in react-science, people will start misusing it.

@stropitek stropitek closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2023
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

No branches or pull requests

2 participants