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

67 lines
1.8 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
import { NgaSidebarService, NgaMenuService } from '@nga/theme';
2017-04-26 08:59:57 +03:00
import { NgaThemeService } from '@nga/theme/services/theme.service';
@Component({
selector: 'ngx-header',
2017-04-28 15:14:05 +03:00
styleUrls: ['./header.component.scss'],
template: `
<div class="left">
<i class="control-icon ion ion-navicon" (click)="toggleSidebar()"></i>
<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>
<nga-actions size="medium" inverse 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 inverse [menu]="userMenu" name="Han Solo"></nga-user>
</nga-action>
<nga-action icon="ion-ios-gear-outline"></nga-action>
</nga-actions>
`,
})
2017-04-28 15:14:05 +03:00
export class HeaderComponent {
userMenu = [
{
title: 'Profile',
},
{
title: 'Log out',
},
];
constructor(private sidebarService: NgaSidebarService,
2017-06-07 14:14:57 +03:00
private menuService: NgaMenuService,
private themeService: NgaThemeService) {
}
toggleSidebar() {
this.sidebarService.toggle(true);
}
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');
}
}