Merge branch 'feat/material-theme' into feat/material-demo

This commit is contained in:
Evgeny Lupanov 2020-03-25 19:05:10 +03:00
commit a5061e7c10
92 changed files with 11784 additions and 9163 deletions

View file

@ -4,7 +4,8 @@ import { NbMediaBreakpointsService, NbMenuService, NbSidebarService, NbThemeServ
import { UserData } from '../../../@core/data/users';
import { AnalyticsService, LayoutService } from '../../../@core/utils';
import { map, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { Subject, Observable } from 'rxjs';
import { RippleService } from '../../../@core/utils/ripple.service';
@Component({
selector: 'ngx-header',
@ -14,6 +15,7 @@ import { Subject } from 'rxjs';
export class HeaderComponent implements OnInit, OnDestroy {
private destroy$: Subject<void> = new Subject<void>();
public readonly materialTheme$: Observable<boolean>;
userPictureOnly: boolean = false;
user: any;
@ -34,20 +36,36 @@ export class HeaderComponent implements OnInit, OnDestroy {
value: 'corporate',
name: 'Corporate',
},
{
value: 'material-light',
name: 'Material Light',
},
{
value: 'material-dark',
name: 'Material Dark',
},
];
currentTheme = 'default';
userMenu = [ { title: 'Profile' }, { title: 'Log out' } ];
constructor(private sidebarService: NbSidebarService,
private menuService: NbMenuService,
private themeService: NbThemeService,
private userService: UserData,
private layoutService: LayoutService,
private breakpointService: NbMediaBreakpointsService,
private analytics: AnalyticsService,
) {}
public constructor(
private sidebarService: NbSidebarService,
private menuService: NbMenuService,
private themeService: NbThemeService,
private userService: UserData,
private layoutService: LayoutService,
private breakpointService: NbMediaBreakpointsService,
private analytics: AnalyticsService,
private rippleService: RippleService,
) {
this.materialTheme$ = this.themeService.onThemeChange()
.pipe(map(theme => {
const themeName: string = theme?.name || '';
return themeName.startsWith('material');
}));
}
ngOnInit() {
this.currentTheme = this.themeService.currentTheme;
@ -69,7 +87,10 @@ export class HeaderComponent implements OnInit, OnDestroy {
map(({ name }) => name),
takeUntil(this.destroy$),
)
.subscribe(themeName => this.currentTheme = themeName);
.subscribe(themeName => {
this.currentTheme = themeName;
this.rippleService.toggle(themeName?.startsWith('material'));
});
}
ngOnDestroy() {