Skip to content

Commit

Permalink
Add badges for sidebar view (#21715)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Aug 16, 2024
1 parent 1080a8c commit 91fc238
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/panels/lovelace/views/hui-sidebar-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { fireEvent } from "../../../common/dom/fire_event";
import type { LovelaceViewElement } from "../../../data/lovelace";
import type { LovelaceViewConfig } from "../../../data/lovelace/config/view";
import type { HomeAssistant } from "../../../types";
import { HuiBadge } from "../badges/hui-badge";
import "../badges/hui-view-badges";
import { HuiCard } from "../cards/hui-card";
import { HuiCardOptions } from "../components/hui-card-options";
import { replaceCard } from "../editor/config-util";
Expand All @@ -28,6 +30,8 @@ export class SideBarView extends LitElement implements LovelaceViewElement {

@property({ attribute: false }) public cards: HuiCard[] = [];

@property({ attribute: false }) public badges: HuiBadge[] = [];

@state() private _config?: LovelaceViewConfig;

private _mqlListenerRef?: () => void;
Expand Down Expand Up @@ -85,6 +89,12 @@ export class SideBarView extends LitElement implements LovelaceViewElement {

protected render(): TemplateResult {
return html`
<hui-view-badges
.hass=${this.hass}
.badges=${this.badges}
.lovelace=${this.lovelace}
.viewIndex=${this.index}
></hui-view-badges>
<div
class="container ${this.lovelace?.editMode ? "edit-mode" : ""}"
></div>
Expand Down Expand Up @@ -191,6 +201,12 @@ export class SideBarView extends LitElement implements LovelaceViewElement {
padding-top: 4px;
}
hui-view-badges {
display: block;
margin: 12px 8px 20px 8px;
font-size: 85%;
}
.container {
display: flex;
justify-content: center;
Expand Down

0 comments on commit 91fc238

Please sign in to comment.