Last active
April 6, 2016 17:38
-
-
Save mattmarcum/24cd08f5cf85baf0e456bc72d6bbfe72 to your computer and use it in GitHub Desktop.
drop-down
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({ | |
classNames: ['dropdown-header'] | |
}); |
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({ | |
classNameBindings: [':dropdown-options', 'expanded:expanded'], | |
}); |
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({ | |
classNames: ['dropdown-option'], | |
click(){ | |
this.get('update')(this.get('value')); | |
} | |
}); |
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({ | |
classNames: ['dropdown'], | |
expanded: false, | |
actions: { | |
update(value){ | |
this.get('update')(value); | |
this.set('expanded', false); | |
}, | |
toggleExpanded() { | |
this.toggleProperty('expanded'); | |
} | |
} | |
}); |
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({ | |
timeFrameOptions: Ember.A([ | |
{ value: 7, label: 'Past 7 Days' }, | |
{ value: 30, label: 'Past 30 Days' }, | |
{ value: 90, label: 'Past 90 Days' }, | |
{ value: 'quarter', label: 'Quarter to Date' }, | |
{ value: 'year', label: 'Year to Date' } | |
]), | |
timeFrame: 30, | |
timeFrameLabel: Ember.computed('timeFrame', 'timeFrameOptions', function(){ | |
return this.get('timeFrameOptions').findBy('value', this.get('timeFrame')).label; | |
}), | |
actions: { | |
updateTimeFrame(timeFrameValue){ | |
this.set('timeFrame', timeFrameValue); | |
} | |
} | |
}); |
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: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.dropdown { | |
} | |
.dropdown-header { | |
background: grey; | |
color: white; | |
padding: 10px; | |
border-radius: 10px; | |
text-align: center; | |
} | |
.dropdown-options { | |
max-height: 0; | |
overflow: hidden; | |
transition: max-height 0.5s ease-out; | |
} | |
.dropdown-options-container { | |
background: #999; | |
color: white; | |
padding: 10px; | |
border-radius: 10px; | |
} | |
.dropdown-options.expanded { | |
max-height: 1000px; | |
transition: max-height 0.5s ease-in; | |
} | |
.dropdown-option { | |
padding:5px; | |
border-radius: 5px; | |
text-align: center; | |
} | |
.dropdown-option:hover { | |
background: white; | |
color: grey; | |
} |
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.7.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": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment