Last active
March 18, 2017 17:21
-
-
Save cibernox/0f2a269726df9733b6a7534bf346189d to your computer and use it in GitHub Desktop.
New 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
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| tagName: '', | |
| init() { | |
| this._super(...arguments); | |
| this.uniqId = `input-${Ember.guidFor(this)}`; | |
| } | |
| }); |
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: '', | |
| actions: { | |
| click(e) { | |
| let value = this.get('value'); | |
| if (typeof value === 'boolean') { | |
| e.preventDefault(); | |
| return this.get('onChange')(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.Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| checked: false | |
| }); |
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: 15pt; | |
| color: #444; | |
| } | |
| .x-toggle { | |
| display: inline-block; | |
| flex-wrap: nowrap; | |
| height: auto; | |
| padding: 0 0.35rem; | |
| width: 4rem; | |
| font-size: 1.0rem; | |
| } | |
| .x-toggle.big { | |
| width: 5rem; | |
| } | |
| .x-toggle.big .x-toggle-switch { | |
| height: 2.5em; | |
| } | |
| .x-toggle.big .x-toggle-switch:after, | |
| .x-toggle.big .x-toggle-switch:before { | |
| width: 38px; | |
| height: 38px; | |
| } | |
| .x-toggle-label { | |
| line-height: 2em; | |
| vertical-align: bottom; | |
| } | |
| .x-toggle-label.big { | |
| line-height: 2.5em; | |
| } | |
| .x-toggle-label.green { | |
| color: #8CC152; | |
| } | |
| .x-toggle-label.red { | |
| color: #DA4453; | |
| } | |
| .x-toggle-checkbox { | |
| display: none; | |
| } | |
| .x-toggle-switch { | |
| user-select: none; | |
| outline: 0; | |
| display: flex; | |
| flex-basis: 4em; | |
| height: 2em; | |
| position: relative; | |
| cursor: pointer; | |
| background: #f0f0f0; | |
| border-radius: 2em; | |
| transition: all .4s ease; | |
| } | |
| .x-toggle-switch:after, | |
| .x-toggle-switch:before { | |
| position: relative; | |
| display: block; | |
| content: ""; | |
| width: 30px; | |
| height: 30px; | |
| } | |
| .x-toggle-switch:after { | |
| left: 0; | |
| border-radius: 50%; | |
| background: #fff; | |
| transition: all .2s ease; | |
| border: 1px solid #CCD1D9; | |
| box-shadow: rgba(0, 0, 0, 0.172549) 0px 1.5px 1px 0px; | |
| } | |
| .x-toggle-switch:before { | |
| display: none; | |
| } | |
| .x-toggle-checkbox:checked + .x-toggle-switch { | |
| background: #8CC152; | |
| } | |
| .x-toggle.red .x-toggle-checkbox:checked + .x-toggle-switch { | |
| background: #DA4453; | |
| } | |
| .x-toggle.blue .x-toggle-checkbox:checked + .x-toggle-switch { | |
| background: #5D9CEC; | |
| } | |
| .x-toggle-checkbox:checked + .x-toggle-switch:after { | |
| left: 50%; | |
| } | |
| table { | |
| border-collapse: collapse; | |
| } | |
| td { | |
| border: 1px solid #ccc; | |
| padding: 6px; | |
| } | |
| td:nth-child(2n+1) { | |
| background-color: #fafafa; | |
| } | |
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.11.0", | |
| "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.10.2", | |
| "ember-data": "2.11.0", | |
| "ember-template-compiler": "2.10.2", | |
| "ember-testing": "2.10.2" | |
| }, | |
| "addons": {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment