@dracoui/ember
Version:
Draco Design System for Ember
3 lines (2 loc) • 1.68 kB
JavaScript
import{_ as e,a as r}from"../../../../_rollupPluginBabelHelpers-CLoDr8uC.js";import{assert as t}from"@ember/debug";import i from"../index.js";import{action as s}from"@ember/object";import{Octokit as o}from"@octokit/rest";import{tracked as a}from"@glimmer/tracking";import{precompileTemplate as c}from"@ember/template-compilation";import{setComponentTemplate as n}from"@ember/component";var u,l,m=c('<div class="draco-avatar-github" aria-label={{concat "Avatar for " this.username}} ...attributes>\n <Draco::Avatar @src={{this.userProfilePicture}} @size={{this.size}} @shape={{this.shape}} @alt={{if this.alt this.alt this.username}} />\n\n <Draco::Icon @name="mdi:github" @size={{28}} @color="white" class={{this.classNames}} />\n</div>');let h=(l=e((u=class extends i{get username(){const{username:e}=this.args;return t(`@username for "Draco::Avatar::Github" is required; received: ${e}`,e),e}constructor(e,t){super(e,t),r(this,"userProfilePicture",l,this),this.loadUserProfilePicture()}async loadUserProfilePicture(){const e=new o;try{const{data:r}=await e.users.getByUsername({username:this.username});this.userProfilePicture=r.avatar_url}catch(e){console.error(`Error fetching user data: ${e.message}`)}}get classNames(){const e=["draco-icon-github"];return e.push(`draco-icon-github--size-${this.size}`),e.push(`draco-icon-github--shape-${this.shape}`),e.join(" ")}}).prototype,"userProfilePicture",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),e(u.prototype,"loadUserProfilePicture",[s],Object.getOwnPropertyDescriptor(u.prototype,"loadUserProfilePicture"),u.prototype),u);n(m,h);export{h as default};
//# sourceMappingURL=index.js.map