-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Color picker call events #136
base: main
Are you sure you want to change the base?
Conversation
Thanks @luttje. I like this PR but have a couple of thoughts: I think we should have more descriptive event names so it's clear that it's an event happening for this specific component. I believe both event dispatches can be called the same. What about What if there's multiple color pickers? How does the code know which element it came from? I wonder if we can adjust the payload like:
|
Heya, thanks for checking out this PR. You bring up some good points. I didn't take into account (nor test) what would happen with multiple color picker components on the page. It's been a while since I've worked on this PR and I'm spending some time on other projects atm. I may have some time to rework this PR this weekend. I'll apply a namespace to event names and send the id along. I'll make a test that has multiple components on 1 page to see if only those respond that should. A tiny decision I'd like to ask your preference on: Alpine works fine with either, and both have pro's and cons when you start using short-hand syntax and modifiers: <x-color-picker x-on:buk:color-change.throttle="..." />
<x-color-picker @buk:color-change.throttle="..." />
<!-- or -->
<x-color-picker x-on:buk.color_change.throttle="..." />
<x-color-picker @buk.color_change.throttle="..." /> I can't find any conventions/specs online on how to namespace events (other than most projects using either |
|
@driesvints I've implemented the changes we discussed, two things to note:
Let me know if you want me to change anything else here. I've got time. Thanks in advance for checking out the PR, and thanks for maintaining this project 👍 |
Sure thing, I'll get on it Edit: didn't find the time, will try again coming weekend (13/14th of april) |
3a21278
to
3f72128
Compare
@driesvints Should be rebased and working, ready to squash and merge. I added some e2e tests that match the alpine event listeners I described in blade-ui-kit/docs#22. That should give some certainty that it works with the latest alpine. Let me know if there's anything else, thanks! |
I ran across #132 and was inspired to contribute. This PR makes the component forwards the events
input
(on save) andchange
(on changing color). Users can listen for them like this: