Created
December 31, 2019 10:06
-
-
Save lacek/6d30f11baf761a4c6c4be50be79fcd49 to your computer and use it in GitHub Desktop.
Ember Bootstrap Tooltip
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'; | |
import { computed } from '@ember/object'; | |
export default Ember.Component.extend({ | |
classNames: 'grid-value', | |
attributeBindings: ['style'], | |
value: 0, | |
style: computed('value', function() { | |
let value = this.get('value'); | |
return Ember.String.htmlSafe(`background-color: rgb(${value}, 0, 0)`); | |
}), | |
}); |
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({ | |
init() { | |
this._super(...arguments); | |
this.data = this.getRandomData(); | |
}, | |
rows: 9, | |
columns: 9, | |
getRandomData() { | |
let rows = parseInt(this.get('rows')); | |
let columns = parseInt(this.get('columns')); | |
return [...Array(rows)].map(() => { | |
return [...Array(columns)].map(() => { | |
return ~~(Math.random() * 256); | |
}); | |
}); | |
}, | |
actions: { | |
update() { | |
this.set('data', this.getRandomData()); | |
} | |
} | |
}); |
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; | |
} | |
table { | |
margin-top: 20px; | |
} | |
td { | |
width: 50px; | |
height: 50px; | |
} | |
.grid-value { | |
width: 48px; | |
height: 48px; | |
color: #ccc; | |
padding-top: 12px; | |
text-align: center; | |
} |
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": "2.18.2", | |
"ember-template-compiler": "2.18.2", | |
"ember-testing": "2.18.2" | |
}, | |
"addons": { | |
"ember-data": "2.18.5", | |
"ember-bootstrap": "3.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment