Files
ISA-Frontend/libs/shell/header/src/lib/components/navigation-toggle.component.ts
Lorenz Hilpert 3ed3d0b466 ♻️ refactor(shell-header): restructure with modular sub-components
Reorganize header into focused sub-components:
- ShellNavigationToggleComponent: drawer toggle with dynamic icon
- ShellFontSizeSelectorComponent: accessibility font size control
- ShellLogoutButtonComponent: logout with AuthService integration
- ShellNotificationsToggleComponent: notification panel overlay

Add E2E testing attributes and ARIA accessibility support
2025-12-03 21:16:57 +01:00

57 lines
1.6 KiB
TypeScript

import {
ChangeDetectionStrategy,
Component,
computed,
inject,
} from '@angular/core';
import { logger } from '@isa/core/logging';
import { isaActionClose, isaNavigationSidemenu } from '@isa/icons';
import { NavigationService } from '@isa/shell/common';
import {
IconButtonComponent,
IconButtonColor,
IconButtonSize,
} from '@isa/ui/buttons';
import { provideIcons } from '@ng-icons/core';
@Component({
selector: 'shell-navigation-toggle',
template: `<ui-icon-button
[name]="iconName()"
[color]="IconButtonColor.Primary"
[size]="IconButtonSize.Large"
(click)="toggle()"
data-what="button"
data-which="navigation-toggle"
[attr.aria-label]="ariaLabel()"
[attr.aria-expanded]="navigationService.get()"
/>`,
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [IconButtonComponent],
providers: [provideIcons({ isaNavigationSidemenu, isaActionClose })],
})
export class ShellNavigationToggleComponent {
#logger = logger({ component: 'ShellNavigationToggleComponent' });
readonly navigationService = inject(NavigationService);
readonly IconButtonColor = IconButtonColor;
readonly IconButtonSize = IconButtonSize;
iconName = computed(() => {
const open = this.navigationService.get();
return open ? 'isaActionClose' : 'isaNavigationSidemenu';
});
ariaLabel = computed(() =>
this.navigationService.get() ? 'Menü schließen' : 'Menü öffnen',
);
toggle(): void {
this.navigationService.toggle();
this.#logger.debug('Navigation toggled', () => ({
isOpen: this.navigationService.get(),
}));
}
}