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

Modals: allow per instance override of button text (ex: Confirm yes/no) #683

Closed
endigo9740 opened this issue Dec 14, 2022 · 5 comments · Fixed by #716
Closed

Modals: allow per instance override of button text (ex: Confirm yes/no) #683

endigo9740 opened this issue Dec 14, 2022 · 5 comments · Fixed by #716
Labels
feature request Request a feature or introduce and update to the project. ready to test Ready to be tested for quality assurance.

Comments

@endigo9740
Copy link
Contributor

Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!

Another great idea inspired by @huntabyte

Use case is someone wanting to use a preset confirm type dialog. In addition to the response callback, we should allow the confirm/cancel button text to be overwritten per instance. This would take precedence over the default set by the Modal props.

What type of pull request would this be?

Enhancement

Any links to similar examples or other references we should review?

https://www.skeleton.dev/utilities/modals

@endigo9740 endigo9740 added the feature request Request a feature or introduce and update to the project. label Dec 14, 2022
@fsrtechnologies
Copy link

In a similar vein, it would be nice to be able to select other types of <input> fields - e.g. <input type="date"> - in a standard one-off Modal without needing to build/import a custom component.

Possibly the "type" property in ModalSettings could be extended ('prompt' for the current text input, plus 'date', 'number', 'tel', 'email', 'password', etc.) I do realize that this might not make sense for 'checkbox', 'radio', 'color'...
If this suggestion is implemented, may I also suggest adding 'text' as a synonym for 'prompt', just for consistency?

@endigo9740
Copy link
Contributor Author

Very much agreed, this will be a similar change so I'll make it happen. Thanks for the suggestion!

@endigo9740
Copy link
Contributor Author

See also: #693

@endigo9740
Copy link
Contributor Author

FYI I've updated to support overriding the buttons per the original request. This will be provided via a new PR in a moment.

@fsrtechnologies Unfortunately Svelte doesn't seem to support your request given we use bind: here:

Screen Shot 2022-12-16 at 4 04 56 PM

I could do something hacky like creating a set of if/else blocks for each type we wish to support, but then I'd be repeating the input code over and over in each one - just with the type changed. That seems annoying.

I'd welcome other ideas though!

@endigo9740 endigo9740 linked a pull request Dec 16, 2022 that will close this issue
@endigo9740 endigo9740 added the ready to test Ready to be tested for quality assurance. label Dec 16, 2022
@endigo9740
Copy link
Contributor Author

The PR is available here to test and provide feedback

Preview URL:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request a feature or introduce and update to the project. ready to test Ready to be tested for quality assurance.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants