Created
August 13, 2017 08:12
-
-
Save camskene/366749526a071d4be54ed13f3bdc89bf to your computer and use it in GitHub Desktop.
liquid-wormhole
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: '', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: 'button', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
isExpanded: false, | |
classNames: ['my-component'], | |
actions: { | |
toggle() { | |
this.toggleProperty('isExpanded'); | |
if (!this.get('isExpanded')) { | |
return; | |
} | |
this._setupClickHandler(); | |
}, | |
}, | |
willDestroyElement() { | |
this._super(...arguments); | |
this._teardownClickHandler(); | |
}, | |
_setupClickHandler() { | |
$(document).on(`click.${this.elementId}`, (e) => { | |
if (!e.target.closest(`#${this.elementId}`) && !e.target.closest('.my-component-body')) { | |
this.set('isExpanded', false); | |
this._teardownClickHandler(); | |
} | |
}); | |
}, | |
_teardownClickHandler() { | |
$(document).off(`click.${this.elementId}`); | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.my-component-body { | |
width: 300px; | |
padding: 15px 20px; | |
color: #fff; | |
font-weight: 700; | |
background-color: #2980b9; | |
border: 2px solid rgba(0,0,0,.1); | |
border-radius: 7px; | |
text-align: center; | |
margin: calc(50vh - 29px) auto 0; | |
box-shadow: 0 2px rgba(0,0,0,.15); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function() { | |
this.transition( | |
this.hasClass('my-component-body'), | |
this.toValue(true), | |
this.use('to-right'), | |
this.reverse('to-right'), | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"liquid-wormhole": "v2.0.5" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment