UNPKG

radh-ui

Version:

Stencil Component Starter

47 lines (41 loc) 1.47 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const index = require('./index-710e648a.js'); const radhUserCss = ".login{color:var(--radh-user-login-color, red)}.name{color:var(--radh-user-name-color, red)}"; class RadhUser { constructor(hostRef) { index.registerInstance(this, hostRef); this.selected = index.createEvent(this, "selected", 7); } click() { this.selected.emit(this.innerUser); } parseUserProp(newValue) { if (newValue) this.innerUser = JSON.parse(newValue); } async setUser(user) { this.innerUser = user; } componentWillLoad() { this.parseUserProp(this.user); } render() { const avatar = (() => { if (this.avatar) { return (index.h("blaze-avatar", { size: "super", alt: "placeholder", src: this.innerUser.avatar_url })); } else { return index.h("img", { src: this.innerUser.avatar_url }); } })(); if (this.innerUser) { return (index.h("blaze-card", null, index.h("blaze-card-body", null, avatar), index.h("blaze-card-footer", null, index.h("h4", { class: "login" }, this.innerUser.login), index.h("p", { class: "name" }, this.innerUser.name)))); } } static get watchers() { return { "user": ["parseUserProp"] }; } } RadhUser.style = radhUserCss; exports.radh_user = RadhUser;