mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2024-10-30 01:08:47 +00:00
(pages/settings) Fixed: Drawer shouldn't be closed on 'side' mode when changing the selected panel
This commit is contained in:
parent
cc761d58e5
commit
57ba071fa5
|
@ -18,7 +18,7 @@
|
|||
class="flex px-8 py-5 cursor-pointer"
|
||||
[ngClass]="{'hover:bg-gray-100 dark:hover:bg-hover': !selectedPanel || selectedPanel !== panel.id,
|
||||
'bg-primary-50 dark:bg-hover': selectedPanel && selectedPanel === panel.id}"
|
||||
(click)="selectedPanel = panel.id; drawer.close()">
|
||||
(click)="goToPanel(panel.id)">
|
||||
<mat-icon
|
||||
[ngClass]="{'text-hint': !selectedPanel || selectedPanel !== panel.id,
|
||||
'text-primary dark:text-primary-500': selectedPanel && selectedPanel === panel.id}"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { MatDrawer } from '@angular/material/sidenav';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
||||
|
@ -11,6 +12,7 @@ import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
|||
})
|
||||
export class SettingsComponent implements OnInit, OnDestroy
|
||||
{
|
||||
@ViewChild('drawer') drawer: MatDrawer;
|
||||
drawerMode: 'over' | 'side' = 'side';
|
||||
drawerOpened: boolean = true;
|
||||
panels: any[] = [];
|
||||
|
@ -106,6 +108,22 @@ export class SettingsComponent implements OnInit, OnDestroy
|
|||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Navigate to the panel
|
||||
*
|
||||
* @param panel
|
||||
*/
|
||||
goToPanel(panel: string): void
|
||||
{
|
||||
this.selectedPanel = panel;
|
||||
|
||||
// Close the drawer on 'over' mode
|
||||
if ( this.drawerMode === 'over' )
|
||||
{
|
||||
this.drawer.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Track by function for ngFor loops
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user