Last active
December 28, 2016 09:04
-
-
Save 3AHAT0P/74b1723b1c8db5b8c39eaedd6c28b093 to your computer and use it in GitHub Desktop.
test
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({ | |
componentName: 'rd-block', | |
mods: null, | |
classNameBindings: ['componentName', 'modClassNames'], | |
modClassNames: Ember.computed('componentName', 'mods', 'mods.[]', { | |
get() { | |
let componentName = this.get('componentName'); | |
let mods = this.get('mods') || []; | |
return mods.map(function(mod) { | |
return `${componentName}--${mod}`; | |
}).join(' '); | |
} | |
}), | |
init() { | |
this._super(...arguments); | |
this.set('mods', ['bgc-red']); | |
}, | |
actions: { | |
hit() { | |
this.set('mods.hitted', true); | |
//this.set('mod-hitted', true); | |
} | |
} | |
}); | |
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
import Ember from 'ember'; | |
export function bem(params, hash) { | |
let block = Ember.get(hash, 'block') || '', | |
element = Ember.get(hash, 'element') || '', | |
mods = (Ember.get(hash, 'mods') || '').w(); | |
let classNameBasePart = element === '' ? `${block}` : `${block}__${element}`; | |
return [ | |
classNameBasePart | |
].concat( | |
mods.map(function(mod) { | |
return `${classNameBasePart}--${mod}`; | |
}) | |
).join(' '); | |
} | |
export default Ember.Helper.helper(bem); |
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; | |
} | |
.rd-block { | |
width: 100px; | |
height: 100px; | |
padding-right: 50px; | |
background-color: #ccc; | |
} | |
.rd-block:hover { | |
background-color: #aaa; | |
} | |
.rd-block--bgc-red, | |
.rd-block__header--bgc-red, | |
.rd-block__footer--bgc-red { | |
background-color: #f00; | |
} | |
.rd-block--bgc-blue, | |
.rd-block__header--bgc-blue, | |
.rd-block__footer--bgc-blue { | |
background-color: #00f; | |
} | |
.rd-block--overflow-auto, | |
.rd-block__header--overflow-auto, | |
.rd-block__footer--overflow-auto { | |
overflow: auto; | |
} | |
.rd-block__elem { | |
width: 100%; | |
height: 20px; | |
background-color: #008000; | |
} | |
.rd-block__header { | |
width: 100%; | |
height: 50px; | |
} | |
.rd-block__header--opacity-06 { | |
opacity: 0.6; | |
} | |
.rd-block__header--test-1, | |
.rd-block__body--test-1, | |
.rd-block__footer--test-1 { | |
padding: 4px; | |
box-sizing: border-box; | |
color: #fff; | |
outline: 1px solid #f00; | |
} | |
.rd-block__body { | |
width: 100%; | |
height: calc(100% - 50px - 30px); | |
} | |
.rd-block__footer { | |
width: 100%; | |
height: 30px; | |
} | |
.footer--font-small { | |
font-size: 8px; | |
} |
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.10.7", | |
"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.0", | |
"ember-data": "2.10.0", | |
"ember-template-compiler": "2.10.0", | |
"ember-testing": "2.10.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment