Skip to content

Instantly share code, notes, and snippets.

@atomaras
Last active March 16, 2017 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomaras/bb74685fb40db5c74827cac27dbeff8d to your computer and use it in GitHub Desktop.
Save atomaras/bb74685fb40db5c74827cac27dbeff8d to your computer and use it in GitHub Desktop.
Flex Liquid-Fire
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
show: true,
notShow: Ember.computed.not('show')
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.parent {
display: flex;
flex-direction: row;
}
.child {
min-width: 100px;
min-height: 100px;
}
.fluid {
flex: 1 1 auto;
}
.fix {
flex: 0 0 auto;
}
.red {
background-color: red;
}
.green {
background-color: green;
}
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<div>
<div>
<label>{{input type="checkbox" checked=show}}Toggle</label>
</div>
<label>1 Liquid-If</label>
<div class="parent">
{{#liquid-if show class=(if show "slideAnimation fix" "slideAnimation fluid")}}
<div class="child fix red">Fix</div>
{{else}}
<div class="child fluid green"><div>Fluid</div></div>
{{/liquid-if}}
</div>
<br>
<label>2 Liquid-If</label>
<div class="parent">
{{#liquid-if show class="slideAnimation fix"}}
<div class="child fix red">Fix</div>
{{/liquid-if}}
{{#liquid-if notShow class="slideAnimation fluid"}}
<div class="child fluid green"><div>Fluid</div></div>
{{/liquid-if}}
</div>
</div>
<br>
<br>
export default function() {
this.transition(
this.hasClass('slideAnimation'),
this.toValue(true),
this.use('toRight'),
this.reverse('toLeft')
);
}
{
"version": "0.11.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.11.0",
"ember-data": "2.11.0",
"ember-template-compiler": "2.11.0",
"ember-testing": "2.11.0"
},
"addons": {
"liquid-fire": "0.27.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment