From b9415cb5f0377b4833a44588da161c94c463a56a Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Tue, 21 Jan 2020 03:29:38 -0600 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20convert=20more-info-defaul?= =?UTF-8?q?t=20to=20LitElement/TypeScript=20(#4546)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../more-info/controls/more-info-default.js | 22 ------------ .../more-info/controls/more-info-default.ts | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 22 deletions(-) delete mode 100644 src/dialogs/more-info/controls/more-info-default.js create mode 100644 src/dialogs/more-info/controls/more-info-default.ts diff --git a/src/dialogs/more-info/controls/more-info-default.js b/src/dialogs/more-info/controls/more-info-default.js deleted file mode 100644 index ee1c44a59d..0000000000 --- a/src/dialogs/more-info/controls/more-info-default.js +++ /dev/null @@ -1,22 +0,0 @@ -import { html } from "@polymer/polymer/lib/utils/html-tag"; -import { PolymerElement } from "@polymer/polymer/polymer-element"; - -import "../../../components/ha-attributes"; - -class MoreInfoDefault extends PolymerElement { - static get template() { - return html` - - `; - } - - static get properties() { - return { - stateObj: { - type: Object, - }, - }; - } -} - -customElements.define("more-info-default", MoreInfoDefault); diff --git a/src/dialogs/more-info/controls/more-info-default.ts b/src/dialogs/more-info/controls/more-info-default.ts new file mode 100644 index 0000000000..946ed20009 --- /dev/null +++ b/src/dialogs/more-info/controls/more-info-default.ts @@ -0,0 +1,34 @@ +import { + LitElement, + html, + TemplateResult, + property, + customElement, +} from "lit-element"; +import { HassEntity } from "home-assistant-js-websocket"; + +import { HomeAssistant } from "../../../types"; + +import "../../../components/ha-attributes"; + +@customElement("more-info-default") +class MoreInfoDefault extends LitElement { + @property() public hass!: HomeAssistant; + @property() public stateObj?: HassEntity; + + protected render(): TemplateResult | void { + if (!this.hass || !this.stateObj) { + return html``; + } + + return html` + + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "more-info-default": MoreInfoDefault; + } +}