Skip to content

Instantly share code, notes, and snippets.

@terrancebryant
Last active June 9, 2017 18:13
Show Gist options
  • Select an option

  • Save terrancebryant/ccfa06077e5f6a5a12df5b54bde7ba26 to your computer and use it in GitHub Desktop.

Select an option

Save terrancebryant/ccfa06077e5f6a5a12df5b54bde7ba26 to your computer and use it in GitHub Desktop.
Avatar
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
const { Component, computed, get, isPresent, String: EmberString } = Ember;
export default Ember.Component.extend({
classNames: ['provider-avatar'],
image: computed(function() {
return EmberString.htmlSafe(`background-image: url(https://madeby.google.com/static/images/google_g_logo.svg)`) ;
}).readOnly(),
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
.provider-avatar {
display: -webkit-flex;
display: flex;
}
.provider-avatar__image {
width: 6.2rem;
height: 6.2rem;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
background-size: 85%;
border: 1px solid #EEE;
border-radius: 2px;
}
.provider-avatar__text {
display: -webkit-flex;
display: flex;
flex-flow: column nowrap;
margin-left: 1rem;
-webkit-flex: 1 0 auto;
flex: 1 0 auto;
}
.provider-avatar__title {
color: grey;
font-size: 2.2rem;
line-height: 2.6rem;
margin-top: auto;
}
.provider-avatar__subtitle {
color: lightgrey;
font-size: 1.2rem;
line-height: 1.6rem;
margin-bottom: auto;
}
{{#avatar-display as |avi| }}
{{avi.providerAvatar}}
{{/avatar-display}}
{{yield (hash
providerAvatar=(component 'provider-avatar')
)}}
<div class="provider-avatar__image" style={{image}}></div>
<div class="provider-avatar__text">
{{#if hasBlock}}
{{yield}}
{{else}}
<div class="provider-avatar__title">Bobs Construction</div>
<div class="provider-avatar__subtitle">Works any where anytime</div>
{{/if}}
</div>
{
"version": "0.12.1",
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment