-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[8.x] @aware blade directive #39100
[8.x] @aware blade directive #39100
Conversation
Heh, didn't know you were working on this again and actually just submitted a PR with another approach. Let me know what you think: https://github.com/laravel/framework/pull/39102/files |
Hm. What do you expect the output of my tests to be? With your implementation, I'm expecting: <ul>
<li>slot=Inline child 1, color=orange</li>
<li>slot=Inline child 2, color=pink</li>
<li>slot=Default item 1, color=blue</li>
<li>slot=Default item 2, color=pink</li>
</ul> But actually getting: <ul>
<li>slot=Inline child 1, color=orange</li>
<li>slot=Inline child 2, color=orange</li>
<li>slot=Default item 1, color=blue</li>
<li>slot=Default item 2, color=blue</li>
</ul> It feels like you should be able to explicitly override consumed data. A use case may be: <x-menu style="muted">
<x-menu.item>About</x-menu.item>
<x-menu.item>Contact</x-menu.item>
<x-menu.item style="danger">Log Out</x-menu.item>
</x-menu> |
@inxilpro can you pull in my recent |
@taylorotwell I just updated the tests. I tried to merge yours and mine together so that they covered all the possible cases. Let me know if you have an issue with that. I'll pull in the |
There are two things that I thought of that might need consideration before merge. The first is my comment on the docs PR — defaults set in the The second is whether we want to add an class MenuItem extends Component
{
public $aware = ['color' => 'gray'];
// ...
} |
(I can't really think of any reasonable way to get around the |
@inxilpro I don't think those are major issues. I personally would not add an |
* initial pass at consume directive * rename method * Track render data for consume * Add more variety to tests * formatting * Update tests * Handle flushComponents * rename to aware * formatting * formatting Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
* initial pass at consume directive * rename method * Track render data for consume * Add more variety to tests * formatting * Update tests * Handle flushComponents * rename to aware * formatting * formatting Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
@inxilpro are you able to update the name/description of this PR to match the |
* initial pass at consume directive * rename method * Track render data for consume * Add more variety to tests * formatting * Update tests * Handle flushComponents * rename to aware * formatting * formatting Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
With component class you still use |
This is a re-submit of #39080 that makes the data from any components that are actively being rendered as well as parent components that haven't yet been rendered available to child components via the
@consume
directive: