Skip to content

Commit

Permalink
feat: Created Breadcrumb main component
Browse files Browse the repository at this point in the history
  • Loading branch information
goncaloacbsilva committed Aug 9, 2022
1 parent 221195f commit 45bc743
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
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();
});
});
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();
}
}
}

0 comments on commit 45bc743

Please sign in to comment.