Skip to content

Instantly share code, notes, and snippets.

@xm
Forked from sukima/styles.app.css
Last active November 16, 2017 05:06
Show Gist options
  • Select an option

  • Save xm/0847b148ad77434b3c38a4bf734067db to your computer and use it in GitHub Desktop.

Select an option

Save xm/0847b148ad77434b3c38a4bf734067db to your computer and use it in GitHub Desktop.
Multi-Yielding Component
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['foo-wrapper']
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
.foo-wrapper {
background-color: #0000bb;
color: white;
padding: 10px;
}
.foo-wrapper__foo-a {
background-color: red;
color: white;
margin: 10px;
padding: 10px;
}
.foo-wrapper__foo-b {
background-color: yellow;
color: black;
margin: 10px;
padding: 10px;
}
.foo-wrapper__foo-c {
background-color: green;
color: white;
margin: 10px;
padding: 10px;
}
img {
max-width: 100%;
}
<div class="hack container">
<h1>Example</h1>
{{#foo-wrapper as |foo|}}
{{#foo.a}}This is the Foo A component{{/foo.a}}
{{#foo.b}}This is the Foo B component{{/foo.b}}
{{#foo.c}}This is the Foo C component{{/foo.c}}
{{/foo-wrapper}}
<h1>Output</h1>
<a href="https://i.imgur.com/58x5ais.png">
<img src="https://i.imgur.com/58x5ais.png" title="source: imgur.com">
</a>
</div>
<div class="foo-wrapper__foo-a">
{{yield (hash a=(component "foo-content"))}}
</div>
<div class="foo-wrapper__foo-b">
{{yield (hash b=(component "foo-content"))}}
</div>
<div class="foo-wrapper__foo-c">
{{yield (hash c=(component "foo-content"))}}
</div>
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"hack_css": "https://cdnjs.cloudflare.com/ajax/libs/hack/0.8.0/hack.css",
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment