Forked from samselikoff/components.dropdown-list-item.js
Last active
December 12, 2018 12:34
-
-
Save jameshahn2/45c3fbf9d12440c5e2d1708fd829e7b7 to your computer and use it in GitHub Desktop.
Nested dropdown
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 Component from '@ember/component'; | |
import { computed } from '@ember/object'; | |
export default Component.extend({ | |
mouseEnter() { | |
this.setActiveItems(this); | |
}, | |
mouseLeave() { | |
this.clearActiveItems(); | |
}, | |
isActive: computed('activeItems.[]', function() { | |
return this.activeItems.objectAt(0) === this; | |
}) | |
}); |
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 Component from '@ember/component'; | |
import { task, timeout } from 'ember-concurrency'; | |
import { isEmpty } from '@ember/utils'; | |
export default Component.extend({ | |
init() { | |
this._super(...arguments); | |
this.set('activeItems', []); | |
}, | |
setActiveItems(...path) { | |
this.updateActiveItems.perform(path); | |
}, | |
clearActiveItems() { | |
this.updateActiveItems.perform([]); | |
}, | |
updateActiveItems: task(function*(path) { | |
if (isEmpty(path)) { | |
yield timeout(1000); | |
} | |
this.set('activeItems', path); | |
}).restartable() | |
}); |
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; | |
} | |
ul { | |
width: 80px; | |
display: flex; | |
} | |
li { | |
background: #DAE1E7; | |
width: 200px; | |
padding: 10px; | |
display: block; | |
cursor: pointer; | |
} | |
#arrow-right { | |
margin-top: 0px; | |
height: 0px; | |
border-top: 50px solid transparent; | |
border-bottom: 50px solid transparent; | |
border-left: 50px solid #4F89BF; | |
padding-right: 50px; | |
} | |
.active { | |
background: #FFED4A; | |
} |
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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "3.4.2", | |
"ember-concurrency": "0.8.19", | |
"ember-modal-dialog": "2.4.4", | |
"ember-composable-helpers": "2.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment