Theme tweaks (#6701)

This commit is contained in:
Bram Kragten 2020-08-26 12:38:48 +02:00 committed by GitHub
parent 7702a05464
commit b644f7d23d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 19 deletions

View File

@ -1,8 +1,8 @@
import { Editor } from "codemirror"; import { Editor } from "codemirror";
import { import {
customElement, customElement,
property,
internalProperty, internalProperty,
property,
PropertyValues, PropertyValues,
UpdatingElement, UpdatingElement,
} from "lit-element"; } from "lit-element";
@ -123,7 +123,7 @@ export class HaCodeEditor extends UpdatingElement {
transition: 0.2s ease border-right; transition: 0.2s ease border-right;
} }
.cm-s-default.CodeMirror { .cm-s-default.CodeMirror {
background-color: var(--card-background-color); background-color: var(--code-editor-background-color, var(--card-background-color));
color: var(--primary-text-color); color: var(--primary-text-color);
} }
.cm-s-default .CodeMirror-cursor { .cm-s-default .CodeMirror-cursor {

View File

@ -17,7 +17,7 @@ export interface EntityFilterEntityConfig extends EntityConfig {
} }
export interface DividerConfig { export interface DividerConfig {
type: "divider"; type: "divider";
style: string; style: { [key: string]: string };
} }
export interface SectionConfig { export interface SectionConfig {
type: "section"; type: "section";

View File

@ -1,10 +1,13 @@
import { import {
css,
CSSResult,
customElement, customElement,
html, html,
LitElement,
internalProperty, internalProperty,
LitElement,
TemplateResult, TemplateResult,
} from "lit-element"; } from "lit-element";
import { styleMap } from "lit-html/directives/style-map";
import { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
import { DividerConfig, LovelaceRow } from "../entity-rows/types"; import { DividerConfig, LovelaceRow } from "../entity-rows/types";
@ -19,13 +22,7 @@ class HuiDividerRow extends LitElement implements LovelaceRow {
throw new Error("Error in card configuration."); throw new Error("Error in card configuration.");
} }
this._config = { this._config = config;
style: {
height: "1px",
"background-color": "var(--divider-color)",
},
...config,
};
} }
protected render(): TemplateResult { protected render(): TemplateResult {
@ -33,13 +30,16 @@ class HuiDividerRow extends LitElement implements LovelaceRow {
return html``; return html``;
} }
const el = document.createElement("div"); return html`<div style=${styleMap(this._config.style)}></div>`;
}
Object.keys(this._config.style).forEach((prop) => { static get styles(): CSSResult {
el.style.setProperty(prop, this._config!.style[prop]); return css`
}); div {
height: 1px;
return html` ${el} `; background-color: var(--entities-divider-color, var(--divider-color));
}
`;
} }
} }

View File

@ -3,8 +3,8 @@ import {
CSSResult, CSSResult,
customElement, customElement,
html, html,
LitElement,
internalProperty, internalProperty,
LitElement,
TemplateResult, TemplateResult,
} from "lit-element"; } from "lit-element";
import "../../../components/ha-icon"; import "../../../components/ha-icon";
@ -48,7 +48,7 @@ class HuiSectionRow extends LitElement implements LovelaceRow {
} }
.divider { .divider {
height: 1px; height: 1px;
background-color: var(--divider-color); background-color: var(--entities-divider-color, var(--divider-color));
margin-left: -16px; margin-left: -16px;
margin-right: -16px; margin-right: -16px;
margin-top: 8px; margin-top: 8px;