Configurable drawer icons.

This commit is contained in:
Dermot Duffy
2023-01-24 19:36:54 -08:00
parent e5924db352
commit 92b75c4b1a
4 changed files with 37 additions and 8 deletions
+11 -1
View File
@@ -15,6 +15,11 @@ import drawerStyle from '../scss/drawer.scss';
import { stopEventFromActivatingCardWideActions } from '../utils/action';
import { isHoverableDevice } from '../utils/basic';
export interface DrawerIcons {
open?: string;
closed?: string;
}
@customElement('frigate-card-drawer')
export class FrigateCardDrawer extends LitElement {
@property({ attribute: true, reflect: true })
@@ -26,6 +31,9 @@ export class FrigateCardDrawer extends LitElement {
@property({ type: Boolean, reflect: true, attribute: true })
public open = false;
@property({ attribute: false })
public icons?: DrawerIcons;
// The 'empty' attribute is used in the styling to change the drawer
// visibility and that of all descendants if there is no content. Styling is
// used rather than display or hidden in order to ensure the contents continue
@@ -111,7 +119,9 @@ export class FrigateCardDrawer extends LitElement {
>
<ha-icon
class="control"
icon="${this.open ? 'mdi:menu-open' : 'mdi:menu'}"
icon="${this.open
? this.icons?.open ?? 'mdi:menu-open'
: this.icons?.closed ?? 'mdi:menu'}"
@mouseenter=${() => {
// Only open the drawer on mousenter when the device
// supports hover (otherwise iOS may end up passing on