2017-04-18 19:12:29 +03:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
|
|
2017-04-21 17:23:44 +03:00
|
|
|
import { NgaSidebarService, NgaMenuService } from '@nga/theme';
|
2017-04-26 08:59:57 +03:00
|
|
|
import { NgaThemeService } from '@nga/theme/services/theme.service';
|
2017-04-18 19:12:29 +03:00
|
|
|
|
|
|
|
|
@Component({
|
2017-05-06 14:52:41 +03:00
|
|
|
selector: 'ngx-header',
|
2017-04-28 15:14:05 +03:00
|
|
|
styleUrls: ['./header.component.scss'],
|
2017-04-18 19:12:29 +03:00
|
|
|
template: `
|
|
|
|
|
<div class="left">
|
|
|
|
|
<i class="control-icon ion ion-navicon" (click)="toggleSidebar()"></i>
|
2017-04-26 20:11:54 +03:00
|
|
|
<span class="logo" (click)="goToHome()">NgX <a>Admin</a></span>
|
2017-04-26 08:59:57 +03:00
|
|
|
<button (click)="switchTheme()">Switch Theme!</button>
|
2017-05-11 15:05:04 +03:00
|
|
|
<button (click)="selectDefaultTheme()">Default Theme!</button>
|
2017-04-18 19:12:29 +03:00
|
|
|
</div>
|
2017-05-11 15:05:04 +03:00
|
|
|
|
2017-04-29 18:41:44 +03:00
|
|
|
<nga-actions size="medium" inverse class="right">
|
2017-05-19 19:45:42 +03:00
|
|
|
<nga-action><nga-search type="rotate-layout"></nga-search></nga-action>
|
2017-04-29 18:41:44 +03:00
|
|
|
<nga-action icon="ion-ios-email-outline"></nga-action>
|
|
|
|
|
<nga-action disabled icon="ion-ios-bell-outline"></nga-action>
|
|
|
|
|
<nga-action>
|
2017-05-06 20:32:00 +03:00
|
|
|
<nga-user inverse [menu]="userMenu" name="Han Solo"></nga-user>
|
2017-04-29 18:41:44 +03:00
|
|
|
</nga-action>
|
|
|
|
|
<nga-action icon="ion-ios-gear-outline"></nga-action>
|
|
|
|
|
</nga-actions>
|
2017-04-21 17:23:44 +03:00
|
|
|
`,
|
2017-04-18 19:12:29 +03:00
|
|
|
})
|
2017-04-28 15:14:05 +03:00
|
|
|
export class HeaderComponent {
|
2017-04-29 18:41:44 +03:00
|
|
|
|
|
|
|
|
userMenu = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Profile',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Log out',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2017-04-21 17:23:44 +03:00
|
|
|
constructor(private sidebarService: NgaSidebarService,
|
2017-04-26 08:59:57 +03:00
|
|
|
private menuService: NgaMenuService,
|
|
|
|
|
private themeService: NgaThemeService) {
|
2017-04-18 19:12:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleSidebar() {
|
|
|
|
|
this.sidebarService.toggle(true);
|
|
|
|
|
}
|
2017-04-21 17:23:44 +03:00
|
|
|
|
|
|
|
|
goToHome() {
|
|
|
|
|
this.menuService.navigateHome();
|
|
|
|
|
}
|
2017-04-26 08:59:57 +03:00
|
|
|
|
|
|
|
|
switchTheme() {
|
2017-05-16 15:40:03 +03:00
|
|
|
if (this.themeService.currentTheme === 'light') {
|
2017-05-06 20:32:00 +03:00
|
|
|
this.themeService.changeTheme('cosmic');
|
2017-04-26 08:59:57 +03:00
|
|
|
} else {
|
2017-05-06 20:32:00 +03:00
|
|
|
this.themeService.changeTheme('light');
|
2017-04-26 08:59:57 +03:00
|
|
|
}
|
|
|
|
|
}
|
2017-05-11 15:05:04 +03:00
|
|
|
|
|
|
|
|
selectDefaultTheme() {
|
|
|
|
|
this.themeService.changeTheme('default');
|
|
|
|
|
}
|
2017-04-18 19:12:29 +03:00
|
|
|
}
|