logo fix
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<header class="novo-header">
|
<header class="novo-header">
|
||||||
<div class="novo-header-container">
|
<div class="novo-header-container">
|
||||||
<div class="novo-left">
|
<div class="novo-left">
|
||||||
<a [routerLink]="'/' | langRoute" class="novo-logo" (click)="closeMenu()">
|
<a [attr.href]="homeUrl" class="novo-logo" (click)="navigateHome($event)">
|
||||||
<app-logo />
|
<app-logo />
|
||||||
<!-- <span class="novo-brand">{{ brandName }}</span> -->
|
<!-- <span class="novo-brand">{{ brandName }}</span> -->
|
||||||
</a>
|
</a>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<header class="dexar-header">
|
<header class="dexar-header">
|
||||||
<div class="dexar-header-container">
|
<div class="dexar-header-container">
|
||||||
<!-- Logo -->
|
<!-- Logo -->
|
||||||
<a [routerLink]="'/' | langRoute" class="dexar-logo" (click)="closeMenu()">
|
<a [attr.href]="homeUrl" class="dexar-logo" (click)="navigateHome($event)">
|
||||||
<app-logo />
|
<app-logo />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ export class HeaderComponent {
|
|||||||
this.cartItemCount = this.cartService.itemCount;
|
this.cartItemCount = this.cartService.itemCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get homeUrl(): string {
|
||||||
|
return `/${this.langService.currentLanguage()}`;
|
||||||
|
}
|
||||||
|
|
||||||
toggleMenu(): void {
|
toggleMenu(): void {
|
||||||
this.menuOpen = !this.menuOpen;
|
this.menuOpen = !this.menuOpen;
|
||||||
if (this.menuOpen) {
|
if (this.menuOpen) {
|
||||||
@@ -44,6 +48,23 @@ export class HeaderComponent {
|
|||||||
this.renderer.removeClass(this.document.body, 'dexar-menu-open');
|
this.renderer.removeClass(this.document.body, 'dexar-menu-open');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
navigateHome(event?: Event): void {
|
||||||
|
event?.preventDefault();
|
||||||
|
this.closeMenu();
|
||||||
|
|
||||||
|
const homeUrl = this.homeUrl;
|
||||||
|
const currentUrl = this.router.url.split('?')[0].split('#')[0];
|
||||||
|
|
||||||
|
if (currentUrl === homeUrl || currentUrl === `${homeUrl}/`) {
|
||||||
|
this.document.defaultView?.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.router.navigateByUrl(homeUrl).then(() => {
|
||||||
|
this.document.defaultView?.scrollTo({ top: 0, behavior: 'auto' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
navigateToSearch(): void {
|
navigateToSearch(): void {
|
||||||
const lang = this.langService.currentLanguage();
|
const lang = this.langService.currentLanguage();
|
||||||
this.router.navigate([`/${lang}/search`]);
|
this.router.navigate([`/${lang}/search`]);
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ import { environment } from '../../../environments/environment';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-logo',
|
selector: 'app-logo',
|
||||||
template: `<img [src]="logoPath" [alt]="brandName + ' logo'" class="logo-img" fetchpriority="high" />`,
|
template: `<img [src]="logoPath" [alt]="brandName + ' logo'" class="logo-img" fetchpriority="high" draggable="false" />`,
|
||||||
styles: [`
|
styles: [`
|
||||||
.logo-img {
|
.logo-img {
|
||||||
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
`],
|
`],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
|
|||||||
Reference in New Issue
Block a user