Last active
March 30, 2019 18:47
-
-
Save trek/42f95212d52c8d24794f2f90001a9185 to your computer and use it in GitHub Desktop.
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 Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
import { action } from '@ember/object'; | |
export default class AvatarComponent extends Component { | |
size = 48; | |
@tracked letterform; | |
get alt() { | |
return `Profile image for ${this.args.name}`; | |
} | |
get src() { | |
if (this.letterform) { | |
return this.letterform; | |
} | |
let { companyId } = this.args; | |
return `https://s3.amazonaws.com/somebucket/companies/${companyId}`; | |
} | |
@action useLetterform() { | |
this.letterform = dataUriAsSrc(this.args.name, this.size); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment