optimisation

This commit is contained in:
sdarbinyan
2026-03-01 03:01:31 +04:00
parent e32ee998c1
commit b71e806bca
13 changed files with 603 additions and 51 deletions

View File

@@ -12,7 +12,7 @@ import { CommonModule } from '@angular/common';
@for (item of [1,2,3,4,5]; track item) {
<div class="skeleton-tree-item">
<div class="skeleton-circle"></div>
<div class="skeleton-line" [style.width]="getRandomWidth()"></div>
<div class="skeleton-line" [style.width]="treeWidths[item - 1]"></div>
</div>
}
</div>
@@ -159,8 +159,8 @@ import { CommonModule } from '@angular/common';
export class LoadingSkeletonComponent {
@Input() type: 'tree' | 'card' | 'list' | 'form' = 'list';
getRandomWidth(): string {
const widths = ['60%', '70%', '80%', '90%'];
return widths[Math.floor(Math.random() * widths.length)];
}
/** Pre-computed widths so they don't change between CD cycles (NG0100). */
readonly treeWidths = [1, 2, 3, 4, 5].map(
(_, i) => ['60%', '80%', '70%', '90%', '75%'][i]
);
}