-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Set row height to 56px * Adjust padding and sizes * Adjust margin * Fix pointer-events * Fix image size * Clean code
- Loading branch information
Showing
34 changed files
with
760 additions
and
997 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/panels/lovelace/card-features/common/card-feature-styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { css } from "lit"; | ||
|
||
export const cardFeatureStyles = css` | ||
ha-control-select-menu { | ||
box-sizing: border-box; | ||
--control-select-menu-height: var(--feature-height); | ||
--control-select-menu-border-radius: var(--feature-border-radius); | ||
line-height: 1.2; | ||
display: block; | ||
width: 100%; | ||
} | ||
ha-control-select { | ||
--control-select-color: var(--feature-color); | ||
--control-select-padding: 0; | ||
--control-select-thickness: var(--feature-height); | ||
--control-select-border-radius: var(--feature-border-radius); | ||
--control-select-button-border-radius: var(--feature-border-radius); | ||
} | ||
ha-control-button-group { | ||
--control-button-group-spacing: var(--feature-button-spacing); | ||
--control-button-group-thickness: var(--feature-height); | ||
} | ||
ha-control-slider { | ||
--control-slider-color: var(--feature-color); | ||
--control-slider-background: var(--feature-color); | ||
--control-slider-background-opacity: 0.2; | ||
--control-slider-thickness: var(--feature-height); | ||
--control-slider-border-radius: var(--feature-border-radius); | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { HassEntity } from "home-assistant-js-websocket"; | ||
import { LitElement, html, nothing } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import { HomeAssistant } from "../../../types"; | ||
import type { HuiErrorCard } from "../cards/hui-error-card"; | ||
import { createCardFeatureElement } from "../create-element/create-card-feature-element"; | ||
import type { LovelaceCardFeature } from "../types"; | ||
import type { LovelaceCardFeatureConfig } from "./types"; | ||
|
||
@customElement("hui-card-feature") | ||
export class HuiCardFeature extends LitElement { | ||
@property({ attribute: false }) public hass!: HomeAssistant; | ||
|
||
@property({ attribute: false }) public stateObj!: HassEntity; | ||
|
||
@property({ attribute: false }) public feature?: LovelaceCardFeatureConfig; | ||
|
||
@property({ attribute: false }) public color?: string; | ||
|
||
private _element?: LovelaceCardFeature | HuiErrorCard; | ||
|
||
private _getFeatureElement(feature: LovelaceCardFeatureConfig) { | ||
if (!this._element) { | ||
this._element = createCardFeatureElement(feature); | ||
return this._element; | ||
} | ||
|
||
return this._element; | ||
} | ||
|
||
protected render() { | ||
if (!this.feature) { | ||
return nothing; | ||
} | ||
|
||
const element = this._getFeatureElement(this.feature); | ||
|
||
if (this.hass) { | ||
element.hass = this.hass; | ||
(element as LovelaceCardFeature).stateObj = this.stateObj; | ||
(element as LovelaceCardFeature).color = this.color; | ||
} | ||
return html`${element}`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"hui-card-feature": HuiCardFeature; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.