fix for styling dafult layout

This commit is contained in:
piotrpekala7 2021-02-17 19:09:22 +01:00
parent 6c4cdb06b2
commit 767dc0c963
3 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<div class="dark">
<router-outlet class="dark"></router-outlet>
<div [ngClass]="{dark: darkThemeEnabled, light: !darkThemeEnabled}">
<router-outlet></router-outlet>
<app-notification-box></app-notification-box>
</div>

View File

@ -5,3 +5,7 @@ mat-menu-panel {
.dark {
background: #263238!important;
}
.light {
background: white!important;
}

View File

@ -14,6 +14,8 @@ import { OverlayContainer} from '@angular/cdk/overlay';
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
public darkThemeEnabled: boolean = false;
constructor(
private overlayContainer: OverlayContainer,
iconReg: MatIconRegistry,
@ -48,6 +50,11 @@ export class AppComponent implements OnInit {
}
applyTheme(theme: string) {
if (theme === 'dark-theme') {
this.darkThemeEnabled = true;
} else {
this.darkThemeEnabled = false;
}
this.overlayContainer.getContainerElement().classList.add(theme);
this.componentCssClass = theme;
}