All files / application-header si-header-navigation.component.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                                                            1x 11x 11x     11x       11x      
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { NgClass } from '@angular/common';
import { Component, inject, OnDestroy } from '@angular/core';
import { addIcons, elementThumbnails, SiIconComponent } from '@siemens/element-ng/icon';
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
 
import { SiApplicationHeaderComponent } from './si-application-header.component';
 
@Component({
  selector: 'si-header-navigation',
  imports: [NgClass, SiTranslatePipe, SiIconComponent],
  template: `
    @if (header.launchpad()) {
      <button
        class="header-item focus-inside"
        type="button"
        [ngClass]="'d-' + header.expandBreakpoint() + '-none'"
        (click)="header.openLaunchpad()"
      >
        <si-icon class="icon pe-5" [icon]="icons.elementThumbnails" />
        {{ header.launchpadLabel() | translate }}
      </button>
    }
    <ng-content />
  `,
  host: { class: 'header-navigation', role: 'navigation' }
})
export class SiHeaderNavigationComponent implements OnDestroy {
  protected header = inject(SiApplicationHeaderComponent);
  protected readonly icons = addIcons({ elementThumbnails });
 
  constructor() {
    this.header.hasNavigation.set(true);
  }
 
  ngOnDestroy(): void {
    this.header.hasNavigation.set(false);
  }
}