UNPKG

@dracoui/ember

Version:

Draco Design System for Ember

3 lines (2 loc) 1.87 kB
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{Gitlab as a}from"@gitbeaker/rest";import{tracked as o}from"@glimmer/tracking";import{precompileTemplate as n}from"@ember/template-compilation";import{setComponentTemplate as l}from"@ember/component";var c,m,u=n('<div class="draco-avatar-gitlab" 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\n @name="devicon:gitlab"\n @size={{if (eq this.size "small") 10\n (if (eq this.size "medium") 12 16)\n }}\n class={{this.classNames}}\n />\n</div>');let h=(m=e((c=class extends i{get username(){const{username:e}=this.args;return t(`@username for "Draco::Avatar::Gitlab" is required; received: ${e}`,e),e}constructor(e,t){super(e,t),r(this,"userProfilePicture",m,this),this.loadUserProfilePicture()}async loadUserProfilePicture(){const e=new a({host:"https://gitlab.com"});try{const r=await e.Users.all({username:this.username});if(!(r.length>0))throw new Error(`No GitLab user found with username: ${this.username}`);this.userProfilePicture=r[0].avatar_url}catch(e){console.error(`Error fetching user data: ${e.message}`)}}get classNames(){const e=["draco-icon-gitlab"];return e.push(`draco-icon-gitlab--size-${this.size}`),e.push(`draco-icon-gitlab--shape-${this.shape}`),e.join(" ")}}).prototype,"userProfilePicture",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),e(c.prototype,"loadUserProfilePicture",[s],Object.getOwnPropertyDescriptor(c.prototype,"loadUserProfilePicture"),c.prototype),c);l(u,h);export{h as default}; //# sourceMappingURL=index.js.map