Skip to content

Commit 41cb5be

Browse files
committed
fix(breadcrumb): Include skeleton input
1 parent 85548d9 commit 41cb5be

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/breadcrumb/breadcrumb-item.component.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@ import {
77
@Component({
88
selector: "ibm-breadcrumb-item",
99
template: `
10+
<a class="bx--link"
11+
href="/#"
12+
*ngIf="skeleton">
13+
<ng-container *ngTemplateOutlet="content"></ng-container>
14+
</a>
15+
1016
<a class="bx--link"
1117
href="{{href}}"
12-
*ngIf="href; else content">
18+
*ngIf="!skeleton && href; else content">
1319
<ng-container *ngTemplateOutlet="content"></ng-container>
1420
</a>
1521
<ng-template #content>
1622
<ng-content></ng-content>
1723
</ng-template>`
1824
})
1925
export class BreadcrumbItemComponent {
20-
@Input() href = "/#";
26+
@Input() href: string;
27+
28+
@Input() skeleton = false;
2129

2230
@HostBinding("class.bx--breadcrumb-item") itemClass = true;
2331
}

src/breadcrumb/breadcrumb.component.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import {
22
Component,
3-
Input
3+
Input,
4+
ContentChildren,
5+
QueryList,
6+
AfterContentInit
47
} from "@angular/core";
58

69
import { BreadcrumbItem } from "./breadcrumb-item.interface";
10+
import { BreadcrumbItemComponent } from "./breadcrumb-item.component";
711

812
const MINIMUM_OVERFLOW_THRESHOLD = 4;
913

@@ -51,7 +55,9 @@ const MINIMUM_OVERFLOW_THRESHOLD = 4;
5155
</ng-template>
5256
</nav>`
5357
})
54-
export class Breadcrumb {
58+
export class Breadcrumb implements AfterContentInit {
59+
@ContentChildren(BreadcrumbItemComponent) childs: QueryList<BreadcrumbItemComponent>;
60+
5561
@Input() items: Array<BreadcrumbItem>;
5662

5763
@Input() noTrailingSlash = false;
@@ -74,6 +80,10 @@ export class Breadcrumb {
7480
return this._threshold;
7581
}
7682

83+
ngAfterContentInit() {
84+
this.childs.toArray().forEach(child => child.skeleton = this.skeleton);
85+
}
86+
7787
get shouldShowContent(): boolean {
7888
return !this.items;
7989
}

0 commit comments

Comments
 (0)