-
Notifications
You must be signed in to change notification settings - Fork 62
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
[Idea] component for the wormhole output #39
Comments
You could do things like: <div class="profile-header">
{{#ember-wormhole-receiver header}}
<!-- default content if no wormhole has used this area yet -->
User Profile
{{/ember-wormhole-receiver}}
</div>
<div class="profile-body">
{{yield (hash
header=(component 'ember-wormhole' header)
footer=(component 'ember-wormhole' footer)
)}}
<!--
might even be nice to pass down additional arguments
so (component 'ember-wormhole' 'footer' footerLinks)
which could be used with {{#area.footer as |links|}}
-->
</div>
<!-- might be useful to know if an area was used outside of the receiver -->
<div class="profile-footer">
{{ember-wormhole-receiver footer}}
</div> which could be used like: {{#user-profile data=profile as |areas|}}
{{#areas.header}}
My Profile
{{/areas.header}}
Otherwise it's just the body where we yielded.
{{#areas.footer}}
Last Updated: {{dateUpdated}}
{{/areas.footer}}
{{/user-profile}} This way the user doesn't have to know if the footer is toggled for this to work. Their content just shows up when it should. |
This might be better as another addon that uses ember-wormhole. |
@knownasilya sounds a lot like https://github.com/minutebase/ember-portal which is built on top of wormhole. |
Nice, didn't know about that. |
For anyone interested, here's a working example with ember-portal, https://github.com/knownasilya/ember-yielded-portals |
Here's another interesting implementation I came up with: https://github.com/knownasilya/ember-receive |
Basically the wormhole would know when the receiver is rendered, and only then would it transfer the yielded content.
Something like the following:
This would allow for easier implementations (not when trying to integrate with third-party libs) when working in an ember app. Think a sidebar that has a header (defined in
application/template.hbs
) with a dropdown menu. The sidebar content could be in any route, so we have a receiver in the header and any route can now manipulate that menu easily without having to wire up a service with a boolean.Underneath, the two components would communicate via a service based on the identifier shared by the two.
The text was updated successfully, but these errors were encountered: