radh-ui
Version:
Stencil Component Starter
56 lines (55 loc) • 1.6 kB
JavaScript
import { Component, Event, h, Listen, State } from "@stencil/core";
export class RadhGitlabUsers {
getUserSelected(ev) {
this.toasted.emit(ev.detail);
}
fetchGitLabUsers() {
fetch("/assets/data/users.json")
.then(resp => resp.json())
.then(data => (this.userData = data));
}
componentWillLoad() {
this.fetchGitLabUsers();
}
render() {
if (!this.userData) {
return null;
}
return [
h("radh-fluid-grid", null, this.userData.map(user => (h("radh-user", { avatar: true, user: JSON.stringify(user) }))))
];
}
static get is() { return "radh-gitlab-users"; }
static get originalStyleUrls() { return {
"$": ["radh-gitlab-users.css"]
}; }
static get styleUrls() { return {
"$": ["radh-gitlab-users.css"]
}; }
static get states() { return {
"userData": {}
}; }
static get events() { return [{
"method": "toasted",
"name": "toasted",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}]; }
static get listeners() { return [{
"name": "selected",
"method": "getUserSelected",
"target": undefined,
"capture": false,
"passive": false
}]; }
}