mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Add ha-user-badge to view visibility editor (#6885)
This commit is contained in:
parent
5ff52ea113
commit
42bf350034
@ -39,6 +39,9 @@ class PersonBadge extends LitElement {
|
||||
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
:host {
|
||||
display: contents;
|
||||
}
|
||||
.picture {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
|
@ -104,6 +104,9 @@ class UserBadge extends LitElement {
|
||||
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
:host {
|
||||
display: contents;
|
||||
}
|
||||
.picture {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
|
@ -1,13 +1,13 @@
|
||||
import "@polymer/paper-item/paper-item";
|
||||
import "@polymer/paper-item/paper-icon-item";
|
||||
import "@polymer/paper-item/paper-item-body";
|
||||
import {
|
||||
css,
|
||||
CSSResult,
|
||||
customElement,
|
||||
html,
|
||||
internalProperty,
|
||||
LitElement,
|
||||
property,
|
||||
internalProperty,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
} from "lit-element";
|
||||
@ -15,6 +15,7 @@ import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { compare } from "../../../../common/string/compare";
|
||||
import { HaSwitch } from "../../../../components/ha-switch";
|
||||
import "../../../../components/user/ha-user-badge";
|
||||
import { LovelaceViewConfig, ShowViewConfig } from "../../../../data/lovelace";
|
||||
import { fetchUsers, User } from "../../../../data/user";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
@ -69,14 +70,19 @@ export class HuiViewVisibilityEditor extends LitElement {
|
||||
</p>
|
||||
${this._sortedUsers(this._users).map(
|
||||
(user) => html`
|
||||
<paper-item>
|
||||
<paper-icon-item>
|
||||
<ha-user-badge
|
||||
slot="item-icon"
|
||||
.hass=${this.hass}
|
||||
.user=${user}
|
||||
></ha-user-badge>
|
||||
<paper-item-body>${user.name}</paper-item-body>
|
||||
<ha-switch
|
||||
.userId="${user.id}"
|
||||
@change=${this.valChange}
|
||||
.checked=${this.checkUser(user.id)}
|
||||
></ha-switch>
|
||||
</paper-item>
|
||||
</paper-icon-item>
|
||||
`
|
||||
)}
|
||||
`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user