-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Created Breadcrumb main component
- Loading branch information
1 parent
221195f
commit 45bc743
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
libs/flowbite-angular/src/lib/components/breadcrumb/breadcrumb.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { BreadcrumbComponent } from '.'; | ||
|
||
describe('BreadcrumbComponent', () => { | ||
let component: BreadcrumbComponent; | ||
let fixture: ComponentFixture<BreadcrumbComponent>; | ||
|
||
beforeEach(async () => { | ||
TestBed.configureTestingModule({ | ||
declarations: [BreadcrumbComponent], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(BreadcrumbComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
libs/flowbite-angular/src/lib/components/breadcrumb/breadcrumb.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
AfterViewInit, | ||
Component, | ||
ContentChildren, | ||
Input, | ||
QueryList, | ||
} from '@angular/core'; | ||
import { BreadcrumbItemComponent } from './breadcrumb-item.component'; | ||
|
||
@Component({ | ||
selector: 'flowbite-breadcrumb', | ||
template: ` | ||
<nav | ||
[class]=" | ||
'flex ' + | ||
(solidBackground | ||
? 'px-5 py-3 text-gray-700 border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-800 dark:border-gray-700' | ||
: '') | ||
" | ||
aria-label="Breadcrumb" | ||
> | ||
<ol class="inline-flex items-center space-x-1 md:space-x-3"> | ||
<ng-content></ng-content> | ||
</ol> | ||
</nav> | ||
`, | ||
}) | ||
export class BreadcrumbComponent implements AfterViewInit { | ||
@ContentChildren(BreadcrumbItemComponent) | ||
items?: QueryList<BreadcrumbItemComponent>; | ||
@Input() solidBackground = false; | ||
|
||
ngAfterViewInit() { | ||
if (this.items?.first) { | ||
this.items.first.setAsRoot(); | ||
} | ||
} | ||
} |