Skip to content

Commit dbea986

Browse files
authored
feat(pagination): add new pagination component (#106)
## PR Checklist Please check if your PR fulfills the following requirements: <!--- [ ] Tests for the changes have been added (for bug fixes/features)--> - [x] Docs have been added/updated (for bug fixes/features) ## PR Type What kind of change does this PR introduce? <!-- Please check the one that applies to this PR using "x". --> - [ ] Bugfix - [x] Feature - [ ] Code style update (formatting, local variables) - [ ] Refactoring (no functional changes, no API changes) - [ ] Build related changes - [ ] CI-related changes - [x] Documentation content changes - [ ] Other... Please describe: ## Issue Number <!-- Bugs and features must be linked to an issue. --> Issue Number: N/A ## Does this PR introduce a breaking change? <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. --> - [ ] Yes - [x] No ## Other information Remaining works to do: - [x] fix icons in first/last and prev/next button - [x] possibility to use custom icons, like in accordion (#95) - [ ] ~~possibility to customize buttons' label + internalization~~ - [x] implement different size variables - [x] remove duplications from `libs/flowbite-angular/core/flowbite.theme.init.ts` - [x] remove unused pageChange output - [x] create InjectionTokens for properties (tabs, pageSize, etc..) - [x] use a cleaner way to customize `PaginationButtonDirective` (big thanks @MGREMY ) - [x] requested changes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit ## Release Notes: Flowbite Angular Pagination Component - **New Features** - Introduced multiple Pagination components with various configurations, including default, custom, and text navigation modes. - Added support for customizable pagination styles and attributes such as current page, total items, and page size. - Expanded the available SVG icons for navigation. - **Documentation** - Updated documentation with comprehensive examples for different pagination styles and configurations. - Added compatibility information for library versions with Angular and TailwindCSS. - **Improvements** - Enhanced theming capabilities for pagination components. - Improved error handling for page navigation controls. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents aab3f50 + e8860f1 commit dbea986

24 files changed

Lines changed: 844 additions & 2 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<flowbite-pagination
2+
[totalItems]="100"
3+
[navigationMode]="'both'" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PaginationComponent } from 'flowbite-angular/pagination';
2+
3+
import { Component } from '@angular/core';
4+
5+
@Component({
6+
selector: 'flowbite-demo-pagination-both',
7+
imports: [PaginationComponent],
8+
templateUrl: './_both.component.html',
9+
})
10+
export class FlowbiteBothComponent {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<flowbite-pagination
2+
[currentPage]="20"
3+
[totalItems]="100000"
4+
[pageSize]="50"
5+
[hasFirstLast]="false"
6+
[ariaLabel]="'Custom pagination'"
7+
[customStyle]="{
8+
root: { base: 'flex gap-2' },
9+
}" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PaginationComponent } from 'flowbite-angular/pagination';
2+
3+
import { Component } from '@angular/core';
4+
5+
@Component({
6+
selector: 'flowbite-demo-pagination-custom',
7+
imports: [PaginationComponent],
8+
templateUrl: './_custom.component.html',
9+
})
10+
export class FlowbiteCustomComponent {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<flowbite-pagination [totalItems]="1000" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PaginationComponent } from 'flowbite-angular/pagination';
2+
3+
import { Component } from '@angular/core';
4+
5+
@Component({
6+
selector: 'flowbite-demo-pagination-default',
7+
imports: [PaginationComponent],
8+
templateUrl: './_default.component.html',
9+
})
10+
export class FlowbiteDefaultComponent {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<flowbite-pagination
2+
[totalItems]="100"
3+
[navigationMode]="'text'" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PaginationComponent } from 'flowbite-angular/pagination';
2+
3+
import { Component } from '@angular/core';
4+
5+
@Component({
6+
selector: 'flowbite-demo-pagination-text',
7+
imports: [PaginationComponent],
8+
templateUrl: './_text.component.html',
9+
})
10+
export class FlowbiteTextComponent {}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
keyword: PaginationPage
3+
---
4+
5+
## Default pagination
6+
7+
{{ NgDocActions.demo('flowbiteDefaultComponent', {container: false}) }}
8+
9+
```angular-html file="./_default.component.html" group="default" name="html"
10+
11+
```
12+
13+
```angular-ts file="./_default.component.ts" group="default" name="typescript"
14+
15+
```
16+
17+
## Pagination with text
18+
19+
{{ NgDocActions.demo('flowbiteTextComponent', {container: false}) }}
20+
21+
```angular-html file="./_text.component.html" group="text" name="html"
22+
23+
```
24+
25+
```angular-ts file="./_text.component.ts"#L1 group="text" name="typescript"
26+
27+
```
28+
29+
## Pagination with text and icon
30+
31+
{{ NgDocActions.demo('flowbiteBothComponent', {container: false}) }}
32+
33+
```angular-html file="./_both.component.html" group="both" name="html"
34+
35+
```
36+
37+
```angular-ts file="./_both.component.ts"#L1 group="both" name="typescript"
38+
39+
```
40+
41+
## Customized pagination
42+
43+
{{ NgDocActions.demo('flowbiteCustomComponent', {container: false}) }}
44+
45+
```angular-html file="./_custom.component.html" group="custom" name="html"
46+
47+
```
48+
49+
```angular-ts file="./_custom.component.ts"#L1 group="custom" name="typescript"
50+
51+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import ComponentCategory from '../ng-doc.category';
2+
import { FlowbiteBothComponent } from './_both.component';
3+
import { FlowbiteCustomComponent } from './_custom.component';
4+
import { FlowbiteDefaultComponent } from './_default.component';
5+
import { FlowbiteTextComponent } from './_text.component';
6+
7+
import type { NgDocPage } from '@ng-doc/core';
8+
9+
/**
10+
* Use the pagination component to show a list of buttons to navigate in your tables
11+
*
12+
* @status:info NEW
13+
*/
14+
const pagination: NgDocPage = {
15+
title: 'Pagination',
16+
mdFile: './index.md',
17+
category: ComponentCategory,
18+
order: 10,
19+
demos: {
20+
flowbiteDefaultComponent: FlowbiteDefaultComponent,
21+
flowbiteTextComponent: FlowbiteTextComponent,
22+
flowbiteBothComponent: FlowbiteBothComponent,
23+
flowbiteCustomComponent: FlowbiteCustomComponent,
24+
},
25+
};
26+
27+
export default pagination;

0 commit comments

Comments
 (0)