list booking
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<div class="join">
|
||||
@if (pageCount() > 1) {
|
||||
<button class="join-item btn" (click)="paginate(1)"><</button>
|
||||
}
|
||||
@for (page of pages(); track page){
|
||||
<button class="join-item btn"
|
||||
[class.btn-active]="activePage() === page"
|
||||
(click)="paginate(page)"
|
||||
>{{page}}</button>
|
||||
}
|
||||
@if (pageCount() > 1) {
|
||||
<button class="join-item btn" (click)="paginate(pageCount())">></button>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { Pagination } from './pagination';
|
||||
|
||||
describe('Pagination', () => {
|
||||
let component: Pagination;
|
||||
let fixture: ComponentFixture<Pagination>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [Pagination]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(Pagination);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Component, computed, input, output } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'rs-daisy-pagination',
|
||||
imports: [],
|
||||
templateUrl: './pagination.html',
|
||||
styleUrl: './pagination.css',
|
||||
})
|
||||
export class Pagination {
|
||||
pageCount = input<number>(0);
|
||||
activePage = input<number>(0);
|
||||
pages = computed( () => {
|
||||
console.info("pag.pagecount", this.pageCount())
|
||||
return [...Array(this.pageCount() ?? 1)].map((_,i) => i+1)
|
||||
})
|
||||
|
||||
onPaginate = output<number>();
|
||||
|
||||
|
||||
paginate(page: number){
|
||||
this.onPaginate.emit(page);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ export * from './lib/components/button/button';
|
||||
export * from './lib/components/footer/footer';
|
||||
export * from './lib/components/breadcrumbs/breadcrumbs';
|
||||
export * from './lib/components/modal/modal';
|
||||
export * from './lib/components/pagination/pagination';
|
||||
export * from './lib/components/card/card-with-centered-content-and-paddings/card-with-centered-content-and-paddings';
|
||||
export * from './lib/daisy.types';
|
||||
export * from './lib/layout/';
|
||||
|
||||
Reference in New Issue
Block a user