♻️ convert more-info-default to LitElement/TypeScript (#4546)

This commit is contained in:
Ian Richardson 2020-01-21 03:29:38 -06:00 committed by Bram Kragten
parent fd49e26120
commit b9415cb5f0
2 changed files with 34 additions and 22 deletions

View File

@ -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`
<ha-attributes state-obj="[[stateObj]]"></ha-attributes>
`;
}
static get properties() {
return {
stateObj: {
type: Object,
},
};
}
}
customElements.define("more-info-default", MoreInfoDefault);

View File

@ -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`
<ha-attributes .stateObj=${this.stateObj}></ha-attributes>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
"more-info-default": MoreInfoDefault;
}
}