Refactors header and scroll management logic

Updates ScrollManager to dynamically sync header spacer height using ResizeObserver

Removes explicit spacer animation from HeaderDrawerManager
Simplifies header and scroll interaction by moving height synchronization logic to ScrollManager
This commit is contained in:
Janus C. H. Knudsen 2025-12-07 23:25:02 +01:00
parent 899c600e44
commit dee977d4df
3 changed files with 32 additions and 7 deletions

View file

@ -1,13 +1,13 @@
export class HeaderDrawerManager {
private drawer!: HTMLElement;
private spacer!: HTMLElement;
private expanded = false;
private readonly expandedHeight = 24;
private readonly duration = 200;
init(container: HTMLElement): void {
this.drawer = container.querySelector('swp-header-drawer')!;
this.spacer = container.querySelector('swp-header-spacer')!;
if (!this.drawer) console.error('HeaderDrawerManager: swp-header-drawer not found');
}
toggle(): void {
@ -37,8 +37,8 @@ export class HeaderDrawerManager {
fill: 'forwards'
};
// Kun animér drawer - ScrollManager synkroniserer header-spacer via ResizeObserver
this.drawer.animate(keyframes, options);
this.spacer.animate(keyframes, options);
}
isExpanded(): boolean {