Last active
April 27, 2018 04:53
-
-
Save megganeturner/fbc83802a59b0f170cf5835b1120c0da to your computer and use it in GitHub Desktop.
dropdown action
This file contains 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({ | |
dropdownVisible: false, | |
isLoading: null, | |
dropdownClass: Ember.computed('dropdownVisible', function p () { | |
const visible = this.get('dropdownVisible'); | |
return visible ? 'visible' : 'hidden'; | |
}), | |
mouseEnter (e) { | |
if (e.target.className !== 'clickMe' && this.get('dropdownVisible') === false) { | |
console.log('hello'); | |
this.set('dropdownVisible', true); | |
} | |
}, | |
mouseLeave () { | |
this.set('dropdownVisible', false); | |
}, | |
actions: { | |
handleClick () { | |
this.set('isLoading', true); | |
window.setTimeout(() => { | |
this.set('dropdownVisible', true); | |
this.set('isLoading', false); | |
}, 1000); | |
} | |
} | |
}); |
This file contains 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({ | |
dropdownVisible: false, | |
isLoading: null, | |
dropdownClass: Ember.computed('dropdownVisible', function p () { | |
const visible = this.get('dropdownVisible'); | |
return visible ? 'visible' : 'hidden'; | |
}), | |
mouseEnter (e) { | |
if (e.target.className !== 'clickMe' && this.get('dropdownVisible') === false) { | |
console.log('hello'); | |
this.set('dropdownVisible', true); | |
} | |
}, | |
mouseLeave () { | |
this.set('dropdownVisible', false); | |
}, | |
actions: { | |
handleClick () { | |
this.set('isLoading', true); | |
window.setTimeout(() => { | |
this.set('dropdownVisible', true); | |
this.set('isLoading', false); | |
}, 1000); | |
} | |
} | |
}); |
This file contains 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 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: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
text-align: center; | |
} | |
.clickMe { | |
border: 1px solid dodgerblue; | |
} | |
.visible { | |
transition: all 500ms linear; | |
width: auto; | |
border: 1px solid pink; | |
visibility: visible; | |
opacity: 1; | |
} | |
.hidden { | |
transition: all 500ms linear; | |
transition-delay: 1s; | |
border: 1px solid pink; | |
visibility: hidden; | |
opacity: 0; | |
} | |
.loading { | |
color: dodgerblue; | |
} | |
img { | |
height: 25px; | |
} |
This file contains 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.13.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.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment