mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-02 07:38:49 +01:00
feat(demo): new layout for demo header, add call-to-action cards (#1979)
This commit is contained in:
parent
43cc3a1556
commit
a71c8281ab
8 changed files with 270 additions and 80 deletions
|
|
@ -1,11 +1,8 @@
|
|||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
import { NbMenuService, NbSidebarService } from '@nebular/theme';
|
||||
import { UserData } from '../../../@core/data/users';
|
||||
import { AnalyticsService } from '../../../@core/utils/analytics.service';
|
||||
import { takeWhile } from 'rxjs/operators/takeWhile';
|
||||
import { fromEvent as observableFromEvent } from 'rxjs/observable/fromEvent';
|
||||
import { AbService } from '../../../@core/utils/ab.service';
|
||||
import { AnalyticsService } from '../../../@core/utils';
|
||||
import { LayoutService } from '../../../@core/utils';
|
||||
|
||||
@Component({
|
||||
|
|
@ -13,44 +10,23 @@ import { LayoutService } from '../../../@core/utils';
|
|||
styleUrls: ['./header.component.scss'],
|
||||
templateUrl: './header.component.html',
|
||||
})
|
||||
export class HeaderComponent implements OnInit , OnDestroy {
|
||||
export class HeaderComponent implements OnInit {
|
||||
|
||||
@Input() position = 'normal';
|
||||
|
||||
user: any;
|
||||
hireTextVariant: string = 'solution-hire';
|
||||
userMenu = [{ title: 'Profile' }, { title: 'Log out' }];
|
||||
|
||||
private alive = true;
|
||||
userMenu = [{ title: 'Profile' }, { title: 'Log out' }];
|
||||
|
||||
constructor(private sidebarService: NbSidebarService,
|
||||
private menuService: NbMenuService,
|
||||
private userService: UserData,
|
||||
private analytics: AnalyticsService,
|
||||
private abService: AbService,
|
||||
private layoutService: LayoutService) {
|
||||
|
||||
observableFromEvent(document, 'mouseup')
|
||||
.pipe(takeWhile(() => this.alive))
|
||||
.subscribe(() => {
|
||||
let selection: any;
|
||||
if (window.getSelection) {
|
||||
selection = window.getSelection();
|
||||
} else if ((<any> document).selection) {
|
||||
selection = (<any> document).selection.createRange();
|
||||
}
|
||||
|
||||
if (selection && selection.toString() === 'contact@akveo.com') {
|
||||
this.analytics.trackEvent('clickContactEmail', 'select');
|
||||
}
|
||||
});
|
||||
}
|
||||
private layoutService: LayoutService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.userService.getUsers()
|
||||
.subscribe((users: any) => this.user = users.nick);
|
||||
|
||||
this.listenForVariants();
|
||||
}
|
||||
|
||||
toggleSidebar(): boolean {
|
||||
|
|
@ -71,23 +47,4 @@ export class HeaderComponent implements OnInit , OnDestroy {
|
|||
trackEmailClick() {
|
||||
this.analytics.trackEvent('clickContactEmail', 'click');
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.alive = false;
|
||||
}
|
||||
|
||||
listenForVariants() {
|
||||
const variants = [
|
||||
AbService.VARIANT_DEVELOPERS_HIRE,
|
||||
AbService.VARIANT_HIGHLIGHT_HIRE,
|
||||
AbService.VARIANT_SOLUTION_HIRE,
|
||||
];
|
||||
|
||||
this.abService.onAbEvent()
|
||||
.subscribe((e: { name: string }) => {
|
||||
if (variants.includes(e.name)) {
|
||||
this.hireTextVariant = e.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue