radh-ui
Version:
Stencil Component Starter
43 lines (39 loc) • 1.38 kB
JavaScript
import { r as registerInstance, c as createEvent, h } from './index-a9700b09.js';
const radhUserCss = ".login{color:var(--radh-user-login-color, red)}.name{color:var(--radh-user-name-color, red)}";
class RadhUser {
constructor(hostRef) {
registerInstance(this, hostRef);
this.selected = 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 (h("blaze-avatar", { size: "super", alt: "placeholder", src: this.innerUser.avatar_url }));
}
else {
return h("img", { src: this.innerUser.avatar_url });
}
})();
if (this.innerUser) {
return (h("blaze-card", null, h("blaze-card-body", null, avatar), h("blaze-card-footer", null, h("h4", { class: "login" }, this.innerUser.login), h("p", { class: "name" }, this.innerUser.name))));
}
}
static get watchers() { return {
"user": ["parseUserProp"]
}; }
}
RadhUser.style = radhUserCss;
export { RadhUser as radh_user };