mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
♻️ convert more-info-default to LitElement/TypeScript (#4546)
This commit is contained in:
parent
fd49e26120
commit
b9415cb5f0
@ -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);
|
34
src/dialogs/more-info/controls/more-info-default.ts
Normal file
34
src/dialogs/more-info/controls/more-info-default.ts
Normal 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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user