mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
refactor: simplify breadcrumb component template syntax for clarity
- Replaced switch-case syntax with if-else statements in breadcrumb.component.html to enhance readability and maintainability of the template logic. - Streamlined the rendering of breadcrumb items while preserving functionality.
This commit is contained in:
@@ -41,27 +41,24 @@
|
||||
[class.adf-active]="last"
|
||||
title="{{ item.name ?? '' | translate }}"
|
||||
class="adf-breadcrumb-item">
|
||||
@switch (breadcrumbItemIsAnchor(last)) {
|
||||
@case (true) {
|
||||
<a
|
||||
href="#"
|
||||
[attr.data-automation-id]="'breadcrumb_' + item.name"
|
||||
class="adf-breadcrumb-item-anchor"
|
||||
(click)="onRoutePathClick(item, $event)"
|
||||
>
|
||||
{{ item.name ?? '' | translate }}
|
||||
</a>
|
||||
}
|
||||
@default {
|
||||
<div class="adf-breadcrumb-item-current" aria-current="location">
|
||||
{{ (selectedRowItemsCount < 1 ? item.name ?? '' : 'BREADCRUMB.HEADER.SELECTED') | translate: { count: selectedRowItemsCount } }}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@if (breadcrumbItemIsAnchor(last)) {
|
||||
<a
|
||||
href="#"
|
||||
[attr.data-automation-id]="'breadcrumb_' + item.name"
|
||||
class="adf-breadcrumb-item-anchor"
|
||||
(click)="onRoutePathClick(item, $event)"
|
||||
>
|
||||
{{ item.name ?? '' | translate }}
|
||||
</a>
|
||||
} @else {
|
||||
<div class="adf-breadcrumb-item-current" aria-current="location">
|
||||
{{ (selectedRowItemsCount < 1 ? item.name ?? '' : 'BREADCRUMB.HEADER.SELECTED') | translate: { count: selectedRowItemsCount } }}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!last) {
|
||||
<mat-icon class="adf-breadcrumb-item-chevron" adf-icon="chevron_right" />
|
||||
}
|
||||
@if (!last) {
|
||||
<mat-icon class="adf-breadcrumb-item-chevron" adf-icon="chevron_right" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user