-
-
Notifications
You must be signed in to change notification settings - Fork 317
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 Modal component #750
Comments
@seancolsen The plan look pretty good to me overall. I have a few suggestions:
|
Thanks @pavish General comments
Configuring the close behavior+1 on all being able to configure the closing behavior. I actually had written some additional specs for that in my original ticket but deleted them so as to keep my suggestion simpler at the start. What do you think about the following approach?
TitleWhat do you think about the following approach?
Why not always us a slot?
|
|
|
@seancolsen I am removing the technical debt label as this is more of an improvement over existing component. The idea when we build components is that we only build what is immediately required, and then improve upon them as we require more features. Let me know if you have further thoughts on this approach. |
Problem
Our current
Modal
component is very simplistic and could use some improvements.Proposed improvements
isOpen
state, eliminating the need hold that state in local variables within consuming components.title
prop.close
function as a slot prop which allows the modal children to close the modal.Proposed component design
Within
App.svelte
, insert:Within any consuming component:
The modal trigger and content are coupled only by sharing the same
id
string, which should be unique across allModal
instances. This decoupling allows the trigger and content to exist far apart from each other in the component tree if needed.Within
ModalManager.ts
:@pavish what do you think of this plan?
The text was updated successfully, but these errors were encountered: