Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

API change proposal #2

Merged
merged 6 commits into from
Jul 30, 2023
Merged

API change proposal #2

merged 6 commits into from
Jul 30, 2023

Conversation

Rigo-m
Copy link
Contributor

@Rigo-m Rigo-m commented Jul 30, 2023

By leveraging useState and v-models I think we can make nuxt-modal have a better DX.

Not only is it easier to handle multiple modals in one component, but also you can easily access a modal status from within different parts of a project, just by using the same key.

Also, I've added the possibility to pass a v-model to an inline nuxt modal and forget about the name of the modal altogether, making some kind of "anonymous" modals.

Check App.vue to see the difference between the two implementations.

As a side note, this approach doesn't rely on reduntant close events as before

@Rigo-m Rigo-m marked this pull request as draft July 30, 2023 14:55
@Rigo-m
Copy link
Contributor Author

Rigo-m commented Jul 30, 2023

I removed custom data content passed to the modal since I didn't see a clear usage of it.
It's also possible to pass the open/close method to slots for easier close implementation in buttons

Let me know what you think

@timb-103 timb-103 marked this pull request as ready for review July 30, 2023 23:59
@timb-103 timb-103 merged commit 58f3a98 into timb-103:master Jul 30, 2023
@timb-103
Copy link
Owner

Great work, makes it much easier to use + the transitions are better on closing as we're not destroying the component when it closes.

Merged into master!

@timb-103
Copy link
Owner

PS. I updated the readme, let me know if you think it's good!

@Rigo-m
Copy link
Contributor Author

Rigo-m commented Jul 31, 2023

LGTM :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants