Last active
November 4, 2015 22:25
-
-
Save grapho/0cb8efb437e6b9c4d954 to your computer and use it in GitHub Desktop.
Dropdown Menu
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:'Dropdown Component', | |
| menuSelectionOptions: [ | |
| Ember.Object.create({ | |
| label: "Case#: 123", | |
| value: 1 | |
| }), | |
| Ember.Object.create({ | |
| label: "Case#: 45699", | |
| value: 2 | |
| }), | |
| Ember.Object.create({ | |
| label: "Case#: 789", | |
| value: 3 | |
| }) | |
| ], | |
| menuSelection: null, | |
| }); |
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; | |
| } | |
| *, *:before, *:after { | |
| box-sizing: border-box; | |
| } | |
| .menu-bar { | |
| height: 40px; | |
| border-radius: 4px; | |
| background: linear-gradient(#fff, #eee); | |
| box-shadow: | |
| 0 0 2px rgba(0, 0, 0, .2), | |
| 0 1px 2px rgba(0, 0, 0, .2); | |
| } | |
| dropdown-menu { | |
| display: inline-block; | |
| height: 100%; | |
| position: relative; | |
| outline: 0; | |
| box-shadow: none; | |
| } | |
| dropdown-menu .menu_display { | |
| height: 100%; | |
| display: flex; | |
| position: relative; | |
| transition: box-shadow 150ms; | |
| } | |
| dropdown-menu .menu_display .menu_caret { | |
| display: block; | |
| height: 16px; | |
| width: 16px; | |
| line-height: 16px; | |
| text-align: center; | |
| position: absolute; | |
| right: 8px; | |
| top: calc(50% - 8px); | |
| } | |
| dropdown-menu.has-focus .menu_display { | |
| height: calc(100% + 1px); | |
| background-color: #fff; | |
| border-bottom: 1px dotted rgba(0, 0, 0, 0); | |
| box-shadow: | |
| 0 0 2px rgba(0, 0, 0, .2), | |
| 0 2px 4px rgba(0, 0, 0, .4); | |
| } | |
| dropdown-menu .menu_selected-item { | |
| margin: auto 0; | |
| position: relative; | |
| } | |
| dropdown-menu .menu_display .menu_selected-item .menu_icon { | |
| display: block; | |
| height: 16px; | |
| width: 16px; | |
| line-height: 16px; | |
| text-align: center; | |
| position: absolute; | |
| left: -20px; | |
| top: calc(50% - 8px); | |
| } | |
| dropdown-menu .menu_selection-container { | |
| background-color: #fff; | |
| overflow-y: hidden; | |
| height: 0; | |
| outline: 0; | |
| position: relative; | |
| transition: 150ms; | |
| } | |
| dropdown-menu .menu_selection-container.scrolling { | |
| overflow-y: scroll; | |
| } | |
| dropdown-menu.has-focus .menu_selection-container { | |
| height: auto; | |
| box-shadow: | |
| 0 0 2px rgba(0, 0, 0, .2), | |
| 0 2px 4px rgba(0, 0, 0, .4); | |
| } | |
| dropdown-menu .menu_selection-options { | |
| margin: 0; | |
| padding: 0; | |
| list-style: none; | |
| } | |
| dropdown-menu .menu_display, | |
| dropdown-menu .menu_selection-options button { | |
| padding: 8px 32px 8px 28px; | |
| } | |
| dropdown-menu .menu_selection-options button { | |
| font-size: inherit; | |
| display: block; | |
| width: 100%; | |
| text-align: left; | |
| background: none; | |
| border: 0; | |
| outline: 0; | |
| } | |
| dropdown-menu .menu_selection-options button:hover, | |
| dropdown-menu .menu_selection-options button:focus { | |
| background-color: rgba(0, 0, 0, .02); | |
| } | |
| dropdown-menu .menu_selection-options button.active { | |
| background-color: rgba(0, 0, 0, .6); | |
| color: #eee; | |
| } |
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.4.16", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js", | |
| "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js", | |
| "ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment