Skip to content

Commit

Permalink
Add label for add badge button in masonry and sidebar view (#23827)
Browse files Browse the repository at this point in the history
Add label for add badge button in mansonry and sidebar view
  • Loading branch information
piitaya authored Jan 21, 2025
1 parent ca2a9f9 commit c4b2896
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/panels/lovelace/badges/hui-view-badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export class HuiViewBadges extends LitElement {

@property({ attribute: false }) public viewIndex!: number;

@property({ type: Boolean, attribute: "show-add-label" })
public showAddLabel!: boolean;

@state() _dragging = false;

private _badgeConfigKeys = new WeakMap<HuiBadge, string>();
Expand Down Expand Up @@ -153,6 +156,11 @@ export class HuiViewBadges extends LitElement {
>
<ha-ripple></ha-ripple>
<ha-svg-icon .path=${mdiPlus}></ha-svg-icon>
${this.showAddLabel
? this.hass.localize(
"ui.panel.lovelace.editor.section.add_badge"
)
: nothing}
</button>
`
: nothing}
Expand Down Expand Up @@ -201,6 +209,7 @@ export class HuiViewBadges extends LitElement {
border-color: var(--primary-color);
--mdc-icon-size: 18px;
cursor: pointer;
font-size: 14px;
color: var(--primary-text-color);
--ha-ripple-color: var(--primary-color);
--ha-ripple-hover-opacity: 0.04;
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/views/hui-masonry-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class MasonryView extends LitElement implements LovelaceViewElement {
.badges=${this.badges}
.lovelace=${this.lovelace}
.viewIndex=${this.index}
show-add-label
></hui-view-badges>
<div
id="columns"
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/views/hui-sidebar-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class SideBarView extends LitElement implements LovelaceViewElement {
.badges=${this.badges}
.lovelace=${this.lovelace}
.viewIndex=${this.index}
show-add-label
></hui-view-badges>
<div
class="container ${this.lovelace?.editMode ? "edit-mode" : ""}"
Expand Down

0 comments on commit c4b2896

Please sign in to comment.