fix(dashboard): improve performance with OnPush change detection (#440)
* fix(dashboard): improve performance with OnPush change detection * fix(dashboard): refactor book card component for improved readability and performance * fix(tests): mock matchMedia for improved test compatibility * fix(tests): matchMedia mock for better CI compatibility and support * fix(dashboard): add clearAll method to BookBrowserScrollService and update tests * fix(dashboard): improve performance with content visibility and refactor styles * fix(dashboard): improve scroll performance with estimated total height and refactor layout * fix(tests): add mock for getCurrentUser in userService for improved test coverage * fix(dashboard): implement infinite scroll for book loading and scroll restoration * fix(tests): fix lint error * fix(tests): mock ResizeObserver and IntersectionObserver * fix(tests): mock ResizeObserver and IntersectionObserver (again) * fix(dashboard): improve accessibility and performance by updating aria attributes and optimizing animations * fix(dashboard): improve submenu accessibility and optimize virtual scroller performance * fix(dashboard): clean up imports and improve component structure * fix(dashboard): correct mobile check in author browser component * fix(dashboard): add OnDestroy lifecycle hook to BookBrowserComponent
This commit is contained in:
@@ -94,7 +94,12 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div [@children]="expanded ? 'expanded' : 'collapsed'" class="submenu-container">
|
||||
<div
|
||||
class="submenu-container"
|
||||
[class.expanded]="expanded"
|
||||
[attr.aria-hidden]="!expanded"
|
||||
[attr.inert]="expanded ? null : ''"
|
||||
>
|
||||
@if (item.items) {
|
||||
<ul>
|
||||
@for (child of item.items; track child.routerLink?.join('/') ?? child.label; let i = $index) {
|
||||
|
||||
@@ -154,7 +154,23 @@
|
||||
}
|
||||
|
||||
.submenu-container {
|
||||
display: grid;
|
||||
grid-template-rows: 0fr;
|
||||
transition: grid-template-rows 400ms cubic-bezier(0.86, 0, 0.07, 1);
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
> * {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&.expanded {
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.library-health-dot {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, HostBinding, inject, Input, OnInit } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
import { MenuService } from './app.menu.service';
|
||||
import { NgClass } from '@angular/common';
|
||||
import { Menu } from 'primeng/menu';
|
||||
@@ -25,18 +24,7 @@ import { NavItem } from './app.menu.component';
|
||||
Menu,
|
||||
IconDisplayComponent,
|
||||
Tooltip,
|
||||
TranslocoPipe
|
||||
],
|
||||
animations: [
|
||||
trigger('children', [
|
||||
state('collapsed', style({
|
||||
height: '0'
|
||||
})),
|
||||
state('expanded', style({
|
||||
height: '*'
|
||||
})),
|
||||
transition('collapsed <=> expanded', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)'))
|
||||
])
|
||||
TranslocoPipe,
|
||||
],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user