mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 19:09:48 +00:00
Fix issues with state_color as false (#19776)
* Fix issues with state_color as false * Remove format from glance timestamp * Restore type assertion hack and remove conditional * Revert "removal of glance timestamp format and adjust types to make it work * Revert to minimal change just to pass false state_color
This commit is contained in:
@@ -32,7 +32,9 @@ export class StateBadge extends LitElement {
|
||||
|
||||
@property() public overrideImage?: string;
|
||||
|
||||
@property({ type: Boolean }) public stateColor = false;
|
||||
// Cannot be a boolean attribute because undefined is treated different than
|
||||
// false. When it is undefined, state is still colored for light entities.
|
||||
@property({ attribute: false }) public stateColor?: boolean;
|
||||
|
||||
@property() public color?: string;
|
||||
|
||||
@@ -70,7 +72,7 @@ export class StateBadge extends LitElement {
|
||||
const domain = this.stateObj
|
||||
? computeStateDomain(this.stateObj)
|
||||
: undefined;
|
||||
return this.stateColor || (domain === "light" && this.stateColor !== false);
|
||||
return this.stateColor ?? domain === "light";
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
||||
Reference in New Issue
Block a user