@@ -90,9 +90,8 @@ export class MediaBrowser extends LitElement {
9090 localStorage . setItem ( LAYOUT_KEY , layout ) ;
9191 }
9292
93- private handleMenuAction = ( ev : CustomEvent < { index : number } > ) => {
94- const layouts : LayoutType [ ] = [ 'auto' , 'grid' , 'list' ] ;
95- this . setLayout ( layouts [ ev . detail . index ] ) ;
93+ private handleMenuAction = ( ev : CustomEvent < { item : { value : string } } > ) => {
94+ this . setLayout ( ev . detail . item . value as LayoutType ) ;
9695 } ;
9796
9897 private getStartPath ( ) : string | null {
@@ -255,29 +254,21 @@ export class MediaBrowser extends LitElement {
255254
256255 private renderLayoutMenu ( ) {
257256 return html `
258- <ha- but to n - menu fixed c or ner = "BOTTOM_END" @action = ${ this . handleMenuAction } >
257+ <ha- dropdown @wa-select = ${ this . handleMenuAction } >
259258 <ha- icon- butto n slot= "trigger" .path = ${ mdiDotsVertical } > </ ha- icon- butto n>
260- <ha- lis t- item graphic= "icon" >
259+ <ha- dropdown- item value= "auto" .selected = ${ this . layout === 'auto' } >
260+ <ha- svg- icon slot= "icon" .path = ${ mdiAlphaABoxOutline } > </ ha- svg- icon>
261261 Auto
262- <ha- svg- icon
263- class= ${ this . layout === 'auto' ? 'selected' : '' }
264- slot= "graphic"
265- .path = ${ mdiAlphaABoxOutline }
266- > </ ha- svg- icon>
267- </ ha- lis t- item>
268- <ha- lis t- item graphic= "icon" >
262+ </ ha- dropdown- item>
263+ <ha- dropdown- item value= "grid" .selected = ${ this . layout === 'grid' } >
264+ <ha- svg- icon slot= "icon" .path = ${ mdiGrid } > </ ha- svg- icon>
269265 Grid
270- <ha - svg - icon class = ${ this . layout === 'grid' ? 'selected' : '' } slot = "graphic" . path = ${ mdiGrid } > < / ha- svg - icon >
271- </ ha- l is t - item>
272- <ha- l is t - item graphic = "icon" >
266+ < / ha- dropdown - item >
267+ <ha- dropdown - item value = "list" . selected = ${ this . layout === 'list' } >
268+ <ha- svg - icon slot = "icon" . path = ${ mdiListBoxOutline } > < / ha - svg - icon >
273269 List
274- <ha- svg- icon
275- class= ${ this . layout === 'list' ? 'selected' : '' }
276- slot= "graphic"
277- .path = ${ mdiListBoxOutline }
278- > </ ha- svg- icon>
279- </ ha- lis t- item>
280- </ ha- butto n- menu>
270+ </ ha- dropdown- item>
271+ </ ha- dropdown>
281272 ` ;
282273 }
283274
@@ -504,9 +495,6 @@ export class MediaBrowser extends LitElement {
504495 text-align : center;
505496 margin-top : 50% ;
506497 }
507- ha-svg-icon .selected {
508- color : var (--primary-color );
509- }
510498 ha-icon-button .startpath-active {
511499 color : var (--accent-color );
512500 }
0 commit comments