ngx-admin/src/app/@theme/components/header/header.component.ts

77 lines
2.2 KiB
TypeScript
Raw Normal View History

import { Component, OnInit } from '@angular/core';
import { NgaSidebarService, NgaMenuService } from '@akveo/nga-theme';
import { NgaThemeService } from '@akveo/nga-theme/services/theme.service';
import { UserService } from '../../../@core/data/users.service';
@Component({
selector: 'ngx-header',
2017-04-28 15:14:05 +03:00
styleUrls: ['./header.component.scss'],
template: `
<div class="left">
2017-06-21 17:34:10 +03:00
<a (click)="toggleSidebar()" href="#"><i class="control-icon ion ion-navicon"></i></a>
<span class="logo" (click)="goToHome()">NgX&nbsp;<a>Admin</a></span>
2017-06-07 14:14:57 +03:00
<div class="theme-buttons">
2017-06-13 16:16:52 +03:00
<button class="btn btn-hero-primary" (click)="selectCosmicTheme()">Cosmic</button>
<button class="btn btn-hero-warning" (click)="selectLightTheme()">Light</button>
<button class="btn btn-hero-info" (click)="selectDefaultTheme()">Default</button>
2017-06-07 14:14:57 +03:00
</div>
</div>
2017-06-21 17:34:10 +03:00
<nga-actions size="medium" class="right">
<nga-action><nga-search type="rotate-layout"></nga-search></nga-action>
<nga-action icon="ion-ios-email-outline"></nga-action>
<nga-action disabled icon="ion-ios-bell-outline"></nga-action>
<nga-action>
<nga-user [menu]="userMenu" [name]="user?.name" [picture]="user?.picture"></nga-user>
</nga-action>
<nga-action icon="ion-ios-gear-outline"></nga-action>
</nga-actions>
`,
})
export class HeaderComponent implements OnInit {
user: any;
userMenu = [
{
title: 'Profile',
},
{
title: 'Log out',
},
];
constructor(private sidebarService: NgaSidebarService,
2017-06-21 17:34:10 +03:00
private menuService: NgaMenuService,
private themeService: NgaThemeService,
private userService: UserService) {
}
ngOnInit() {
this.userService.getUsers()
.subscribe((users: any) => this.user = users.nick);
}
2017-06-21 17:34:10 +03:00
toggleSidebar(): boolean {
this.sidebarService.toggle(true);
2017-06-21 17:34:10 +03:00
return false;
}
goToHome() {
this.menuService.navigateHome();
}
2017-04-26 08:59:57 +03:00
2017-06-07 14:14:57 +03:00
selectCosmicTheme() {
this.themeService.changeTheme('cosmic');
}
selectLightTheme() {
this.themeService.changeTheme('light');
2017-04-26 08:59:57 +03:00
}
selectDefaultTheme() {
this.themeService.changeTheme('default');
}
}