Skip to content

Commit 8e0519d

Browse files
committed
Add a breadcrumb and breadcrumb item components
1 parent 7939199 commit 8e0519d

File tree

5 files changed

+49
-50
lines changed

5 files changed

+49
-50
lines changed

src/breadcrumb/breadcrumb-item.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ export class BreadcrumbItemComponent {
2020
@Input() href: string;
2121

2222
@HostBinding("class.bx--breadcrumb-item") itemClass = true;
23-
}
23+
}

src/breadcrumb/breadcrumb-item.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export interface BreadcrumbItem {
1717
* @memberof BreadcrumbItem
1818
*/
1919
href: string;
20-
}
20+
}

src/breadcrumb/breadcrumb.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,4 @@ describe("Breadcrumb", () => {
118118
expect(breadcrumbItemElements.length).toBe(4); // 4 because one is created for the overflow menu
119119
expect(breadcrumbItemElements[1].children[0].name).toEqual("ibm-overflow-menu");
120120
});
121-
});
121+
});

src/breadcrumb/breadcrumb.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ const MINIMUM_OVERFLOW_THRESHOLD = 4;
5151
</nav>`
5252
})
5353
export class Breadcrumb {
54-
items: Array<BreadcrumbItem>;
55-
56-
protected _threshold: number;
54+
@Input() items: Array<BreadcrumbItem>;
5755

5856
@Input() noTrailingSlash = false;
5957

6058
@Input() ariaLabel: string;
6159

60+
protected _threshold: number;
61+
6262
@Input()
6363
set threshold(threshold: number) {
6464
this._threshold = threshold;

src/breadcrumb/breadcrumb.stories.ts

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,46 @@ const createBreadcrumbItems = (count: number): Array<BreadcrumbItem> => {
1515
};
1616

1717
storiesOf("Breadcrumb", module)
18-
.addDecorator(
19-
moduleMetadata({
20-
imports: [
21-
BreadcrumbModule,
22-
DialogModule
23-
]
24-
})
25-
)
26-
.addDecorator(withKnobs)
27-
.add("Basic", () => ({
28-
template: `
29-
<ibm-breadcrumb [noTrailingSlash]="noTrailingSlash">
30-
<ibm-breadcrumb-item href="#1">
31-
Breadcrumb 1
32-
</ibm-breadcrumb-item>
33-
<ibm-breadcrumb-item href="#2">
34-
Breadcrumb 2
35-
</ibm-breadcrumb-item>
36-
<ibm-breadcrumb-item href="#3">
37-
Breadcrumb 3
38-
</ibm-breadcrumb-item>
39-
<ibm-breadcrumb-item href="#4">
40-
Breadcrumb 4
41-
</ibm-breadcrumb-item>
42-
</ibm-breadcrumb>`,
43-
props: {
44-
noTrailingSlash: boolean("noTrailingSlash", true)
45-
}
46-
}))
47-
.add("Model", () => ({
48-
template: `
49-
<ibm-breadcrumb
50-
[noTrailingSlash]="noTrailingSlash"
51-
[threshold]="threshold"
52-
[items]="items(itemCount)">
53-
</ibm-breadcrumb>`,
54-
props: {
55-
noTrailingSlash: boolean("noTrailingSlash", true),
56-
itemCount: number("itemCount", 10),
57-
threshold: number("threshold", 4),
58-
items: createBreadcrumbItems
59-
}
60-
}));
61-
18+
.addDecorator(
19+
moduleMetadata({
20+
imports: [
21+
BreadcrumbModule,
22+
DialogModule
23+
]
24+
})
25+
)
26+
.addDecorator(withKnobs)
27+
.add("Basic", () => ({
28+
template: `
29+
<ibm-breadcrumb [noTrailingSlash]="noTrailingSlash">
30+
<ibm-breadcrumb-item href="#1">
31+
Breadcrumb 1
32+
</ibm-breadcrumb-item>
33+
<ibm-breadcrumb-item href="#2">
34+
Breadcrumb 2
35+
</ibm-breadcrumb-item>
36+
<ibm-breadcrumb-item href="#3">
37+
Breadcrumb 3
38+
</ibm-breadcrumb-item>
39+
<ibm-breadcrumb-item href="#4">
40+
Breadcrumb 4
41+
</ibm-breadcrumb-item>
42+
</ibm-breadcrumb>`,
43+
props: {
44+
noTrailingSlash: boolean("noTrailingSlash", true)
45+
}
46+
}))
47+
.add("Model", () => ({
48+
template: `
49+
<ibm-breadcrumb
50+
[noTrailingSlash]="noTrailingSlash"
51+
[threshold]="threshold"
52+
[items]="items(itemCount)">
53+
</ibm-breadcrumb>`,
54+
props: {
55+
noTrailingSlash: boolean("noTrailingSlash", true),
56+
itemCount: number("itemCount", 10),
57+
threshold: number("threshold", 4),
58+
items: createBreadcrumbItems
59+
}
60+
}));

0 commit comments

Comments
 (0)