Last active
January 14, 2018 19:57
-
-
Save scudco/16a4f65159837eab59918b96cc42b1b4 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({ | |
classNames: ['flex-layout-content'] | |
}); |
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({ | |
classNames: ['flex-layout-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({ | |
classNames: ['flex-layout'] | |
}); |
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({ | |
scale: 1, | |
classNames: ['scalable-container'], | |
didInsertElement() { | |
this.element.style.cssText = ` | |
will-change: transform; | |
transform-origin: 0 0; | |
`; | |
this.updateScale(); | |
}, | |
updateScale() { | |
if (this.isDestroyed) { return; } | |
let windowWidth = window.innerWidth; | |
let elementWidth = this.element.parentElement.offsetWidth; | |
let newScale = elementWidth / windowWidth; | |
let scaleChange = Math.abs(this.scale - newScale); | |
if (scaleChange > 0.0001) { | |
this.element.style.cssText += ` | |
transform: scale(${newScale}); | |
width: ${windowWidth}px; | |
`; | |
this.scale = newScale; | |
} | |
requestAnimationFrame(() => this.updateScale()); | |
}, | |
requestAnimationFrame(callback) { | |
if (window.requestAnimationFrame) { | |
return window.requestAnimationFrame(callback); | |
} | |
return setTimeout(callback, 33); | |
} | |
}); |
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' | |
}); |
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
* { | |
margin: 0; | |
padding: 0; | |
border: 0; } | |
h1, p { | |
margin-bottom: 1rem; } | |
article { | |
padding: 2rem; } | |
.text-center { | |
text-align: center; } | |
.text-right { | |
text-align: right; } | |
html, body, #root, #root > .ember-view, body > .ember-view { | |
height: 100%; } | |
.flex-layout { | |
height: 100%; | |
width: 100%; | |
display: flex; | |
flex-direction: column; } | |
.flex-layout-header { | |
background: #AAA; } | |
.flex-layout-left-sidebar { | |
background: #DDD; | |
order: -1; | |
overflow: scroll; } | |
.flex-layout-middle { | |
display: flex; | |
flex: 1; } | |
.flex-layout-content { | |
border: 1px solid red; | |
overflow: scroll; } | |
.flex-layout-right-sidebar { | |
background: #DDD; | |
overflow: scroll; } | |
.flex-layout-footer { | |
background: #AAA; } |
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.12.1", | |
"EmberENV": { | |
"FEATURES": { | |
"ember-metal-es5-getters": true | |
} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "canary", | |
"ember-template-compiler": "canary", | |
"ember-testing": "canary" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment