-
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.
Allow different types of heading badges (#22109)
* Allow different type of heading item * Update editor * Migrate entities to items * Rename support for string entity * Refactor * Rename to badges and add error state * Update font weight * Feedback * Feedback
- Loading branch information
Showing
19 changed files
with
824 additions
and
394 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { css, CSSResultGroup, html, LitElement } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import { ifDefined } from "lit/directives/if-defined"; | ||
|
||
type HeadingBadgeType = "text" | "button"; | ||
|
||
@customElement("ha-heading-badge") | ||
export class HaBadge extends LitElement { | ||
@property() public type: HeadingBadgeType = "text"; | ||
|
||
protected render() { | ||
return html` | ||
<div | ||
class="heading-badge" | ||
role=${ifDefined(this.type === "button" ? "button" : undefined)} | ||
tabindex=${ifDefined(this.type === "button" ? "0" : undefined)} | ||
> | ||
<slot name="icon"></slot> | ||
<slot></slot> | ||
</div> | ||
`; | ||
} | ||
|
||
static get styles(): CSSResultGroup { | ||
return css` | ||
:host { | ||
color: var(--secondary-text-color); | ||
} | ||
[role="button"] { | ||
cursor: pointer; | ||
} | ||
.heading-badge { | ||
display: flex; | ||
flex-direction: row; | ||
white-space: nowrap; | ||
align-items: center; | ||
gap: 3px; | ||
font-family: Roboto; | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 20px; | ||
letter-spacing: 0.1px; | ||
--mdc-icon-size: 14px; | ||
} | ||
::slotted([slot="icon"]) { | ||
--ha-icon-display: block; | ||
color: var(--icon-color, inherit); | ||
} | ||
`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"ha-heading-badge": HaBadge; | ||
} | ||
} |
248 changes: 0 additions & 248 deletions
248
src/panels/lovelace/cards/heading/hui-heading-entity.ts
This file was deleted.
Oops, something went wrong.
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.