UNPKG

radh-ui

Version:

Stencil Component Starter

29 lines (28 loc) 1.34 kB
import { r as registerInstance, c as createEvent, h } from './index-a9700b09.js'; var radhGithubSearchUserCss = "radh-github-search-user{margin:20px}"; var RadhGithubSearchUser = /** @class */ (function () { function RadhGithubSearchUser(hostRef) { registerInstance(this, hostRef); this.userSearched = createEvent(this, "userSearched", 7); } RadhGithubSearchUser.prototype.handleClick = function () { var _this = this; var username = this.value; fetch("https://api.github.com/users/" + username) .then(function (resp) { return resp.json(); }) .then(function (user) { return _this.userSearched.emit(user); }); }; RadhGithubSearchUser.prototype.handleChange = function (event) { this.value = event.target.value; }; RadhGithubSearchUser.prototype.onchanged = function (ev) { this.value = ev.detail; }; RadhGithubSearchUser.prototype.render = function () { var _this = this; return (h("div", null, h("radh-input-text", { label: "Username:", name: "username" }), h("radh-button", { onClick: function () { return _this.handleClick(); } }, "Search"))); }; return RadhGithubSearchUser; }()); RadhGithubSearchUser.style = radhGithubSearchUserCss; export { RadhGithubSearchUser as radh_github_search_user };