1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

[EC-937] Pre-merge breadcrumbs into master (#4420)

original implementation from ef20ee1882 (https://github.com/bitwarden/clients/pull/3762)
This commit is contained in:
Andreas Coroiu
2023-01-09 18:59:19 +01:00
committed by GitHub
parent 6b1a72851a
commit f4219bada9
8 changed files with 261 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import { Component, ContentChildren, Input, QueryList } from "@angular/core";
import { BreadcrumbComponent } from "./breadcrumb.component";
@Component({
selector: "bit-breadcrumbs",
templateUrl: "./breadcrumbs.component.html",
})
export class BreadcrumbsComponent {
@Input()
show = 3;
private breadcrumbs: BreadcrumbComponent[] = [];
@ContentChildren(BreadcrumbComponent)
protected set breadcrumbList(value: QueryList<BreadcrumbComponent>) {
this.breadcrumbs = value.toArray();
}
protected get beforeOverflow() {
if (this.hasOverflow) {
return this.breadcrumbs.slice(0, this.show - 1);
}
return this.breadcrumbs;
}
protected get overflow() {
return this.breadcrumbs.slice(this.show - 1, -1);
}
protected get afterOverflow() {
return this.breadcrumbs.slice(-1);
}
protected get hasOverflow() {
return this.breadcrumbs.length > this.show;
}
}