From 9a7eb3d4062c7d40b08afc262238e4681ab1d09f Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Fri, 20 Sep 2019 16:10:14 -0500 Subject: [PATCH] light-card: icon option (#3771) * light-card: icon option closes https://github.com/home-assistant/home-assistant-polymer/issues/3768 * add theme select label property * address review comments --- src/panels/lovelace/cards/hui-light-card.ts | 2 +- src/panels/lovelace/cards/types.ts | 1 + .../components/hui-theme-select-editor.ts | 5 +- .../config-elements/hui-light-card-editor.ts | 54 ++++++++++++------- src/translations/en.json | 3 ++ 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/panels/lovelace/cards/hui-light-card.ts b/src/panels/lovelace/cards/hui-light-card.ts index a1efbf274c..bb90cbef11 100644 --- a/src/panels/lovelace/cards/hui-light-card.ts +++ b/src/panels/lovelace/cards/hui-light-card.ts @@ -107,7 +107,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts index 8f1eba6876..df776a158b 100644 --- a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts @@ -23,6 +23,7 @@ const cardConfigStruct = struct({ name: "string?", entity: "string?", theme: "string?", + icon: "string?", }); @customElement("hui-light-card-editor") @@ -49,6 +50,10 @@ export class HuiLightCardEditor extends LitElement return this._config!.entity || ""; } + get _icon(): string { + return this._config!.icon || ""; + } + protected render(): TemplateResult | void { if (!this.hass) { return html``; @@ -57,28 +62,37 @@ export class HuiLightCardEditor extends LitElement return html` ${configElementStyle}
- +
- - + +
+ +
`; } diff --git a/src/translations/en.json b/src/translations/en.json index b1c4c24edd..db4e7a8dac 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1110,6 +1110,9 @@ "para_no_id": "This element doesn't have an ID. Please add an ID to this element in 'ui-lovelace.yaml'.", "para_migrate": "Home Assistant can add ID's to all your cards and views automatically for you by pressing the 'Migrate config' button.", "migrate": "Migrate config" + }, + "theme": { + "theme": "Theme (Optional)" } }, "warning": {