8cc1b02d19
Adds a 3-pane layout option for showing details, as well as a dashboard sub-route for showing contributor details in the new details pane.
31 lines
726 B
JavaScript
31 lines
726 B
JavaScript
import Component from '@ember/component';
|
|
import { alias } from '@ember/object/computed';
|
|
import { computed } from '@ember/object';
|
|
|
|
const SIZES = {
|
|
'small': '128', // pixels
|
|
'medium': '256',
|
|
'large': '512'
|
|
}
|
|
|
|
export default Component.extend({
|
|
contributor: null,
|
|
tagName: 'img',
|
|
classNames: ['avatar'],
|
|
classNameBindings: ['size'],
|
|
attributeBindings: ['src', 'title'],
|
|
size: 'small',
|
|
|
|
src: alias('avatarURL'),
|
|
title: alias('contributor.name'),
|
|
|
|
avatarURL: computed('contributor.github_uid', 'size', function() {
|
|
const github_uid = this.contributor.github_uid;
|
|
|
|
if (github_uid) {
|
|
return `https://avatars2.githubusercontent.com/u/${github_uid}?v=3&s=${SIZES[this.size]}`;
|
|
}
|
|
})
|
|
|
|
});
|