-
Notifications
You must be signed in to change notification settings - Fork 49
feat(pagination): add new pagination component
#106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
18761f3
e6482df
cc20b83
6d48101
9f2ca65
1bd73bd
6a77a41
b2c05d5
a43f5cb
1aa9da0
cbaf247
620f320
2c083bf
ea541d2
a47e774
1ceabbe
c92b724
15376cb
523363e
3edf1c4
e524102
cb31e76
338e5f3
970b79d
b914355
c983fca
434bfa4
783c3ed
0ec0dfa
87b1887
021058b
3947513
bd238c4
e8860f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <flowbite-pagination | ||
| [totalItems]="100" | ||
| [navigationMode]="'both'" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { PaginationComponent } from 'flowbite-angular/pagination'; | ||
|
|
||
| import { Component } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'flowbite-demo-pagination-both', | ||
| imports: [PaginationComponent], | ||
| templateUrl: './_both.component.html', | ||
| }) | ||
| export class FlowbiteBothComponent {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <flowbite-pagination | ||
| [currentPage]="20" | ||
| [totalItems]="100000" | ||
| [pageSize]="50" | ||
| [hasFirstLast]="false" | ||
| [ariaLabel]="'Custom pagination'" | ||
| [customStyle]="{ | ||
| root: { base: 'flex gap-2' }, | ||
| }" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { PaginationComponent } from 'flowbite-angular/pagination'; | ||
|
|
||
| import { Component } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'flowbite-demo-pagination-custom', | ||
| imports: [PaginationComponent], | ||
| templateUrl: './_custom.component.html', | ||
| }) | ||
| export class FlowbiteCustomComponent {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <flowbite-pagination [totalItems]="1000" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { PaginationComponent } from 'flowbite-angular/pagination'; | ||
|
|
||
| import { Component } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'flowbite-demo-pagination-default', | ||
| imports: [PaginationComponent], | ||
| templateUrl: './_default.component.html', | ||
| }) | ||
| export class FlowbiteDefaultComponent {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <flowbite-pagination | ||
| [totalItems]="100" | ||
| [navigationMode]="'text'" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { PaginationComponent } from 'flowbite-angular/pagination'; | ||
|
|
||
| import { Component } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'flowbite-demo-pagination-text', | ||
| imports: [PaginationComponent], | ||
| templateUrl: './_text.component.html', | ||
| }) | ||
| export class FlowbiteTextComponent {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| keyword: PaginationPage | ||
| --- | ||
|
|
||
| ## Default pagination | ||
|
|
||
| {{ NgDocActions.demo('flowbiteDefaultComponent', {container: false}) }} | ||
|
|
||
| ```angular-html file="./_default.component.html" group="default" name="html" | ||
|
|
||
| ``` | ||
|
|
||
| ```angular-ts file="./_default.component.ts" group="default" name="typescript" | ||
|
|
||
| ``` | ||
|
|
||
| ## Pagination with text | ||
|
|
||
| {{ NgDocActions.demo('flowbiteTextComponent', {container: false}) }} | ||
|
|
||
| ```angular-html file="./_text.component.html" group="text" name="html" | ||
|
|
||
| ``` | ||
|
|
||
| ```angular-ts file="./_text.component.ts"#L1 group="text" name="typescript" | ||
|
|
||
| ``` | ||
|
|
||
| ## Pagination with text and icon | ||
|
|
||
| {{ NgDocActions.demo('flowbiteBothComponent', {container: false}) }} | ||
|
|
||
| ```angular-html file="./_both.component.html" group="both" name="html" | ||
|
|
||
| ``` | ||
|
|
||
| ```angular-ts file="./_both.component.ts"#L1 group="both" name="typescript" | ||
|
|
||
| ``` | ||
|
|
||
| ## Customized pagination | ||
|
|
||
| {{ NgDocActions.demo('flowbiteCustomComponent', {container: false}) }} | ||
|
|
||
| ```angular-html file="./_custom.component.html" group="custom" name="html" | ||
|
|
||
| ``` | ||
|
|
||
| ```angular-ts file="./_custom.component.ts"#L1 group="custom" name="typescript" | ||
|
|
||
| ``` | ||
|
Comment on lines
+1
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Documentation needs additional sections for pending features Based on the PR objectives, the documentation is missing several key sections:
Consider adding these sections to align with the planned features: ## Button Labels Customization
Demonstrate how to customize navigation button labels.
## Internationalization
Show how to implement i18n support for pagination labels.
## Size Variants
Examples of different pagination sizes (sm, md, lg).
## Icon Customization
How to customize icons for navigation buttons.🧰 Tools🪛 LanguageTool[uncategorized] ~29-~29: The grammatical number of this noun doesn’t look right. Consider replacing it. (AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import ComponentCategory from '../ng-doc.category'; | ||
| import { FlowbiteBothComponent } from './_both.component'; | ||
| import { FlowbiteCustomComponent } from './_custom.component'; | ||
| import { FlowbiteDefaultComponent } from './_default.component'; | ||
| import { FlowbiteTextComponent } from './_text.component'; | ||
|
|
||
| import type { NgDocPage } from '@ng-doc/core'; | ||
|
|
||
| /** | ||
| * Use the pagination component to show a list of buttons to navigate in your tables | ||
| * | ||
| * @status:info NEW | ||
| */ | ||
| const pagination: NgDocPage = { | ||
| title: 'Pagination', | ||
| mdFile: './index.md', | ||
| category: ComponentCategory, | ||
| order: 10, | ||
| demos: { | ||
| flowbiteDefaultComponent: FlowbiteDefaultComponent, | ||
| flowbiteTextComponent: FlowbiteTextComponent, | ||
| flowbiteBothComponent: FlowbiteBothComponent, | ||
| flowbiteCustomComponent: FlowbiteCustomComponent, | ||
| }, | ||
| }; | ||
|
|
||
| export default pagination; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # flowbite-angular/pagination | ||
|
|
||
| Secondary entry point of `flowbite-angular`. It can be used by importing from | ||
| `flowbite-angular/pagination`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| export { | ||
| PaginationComponent, | ||
| paginationDefaultValueProvider, | ||
| FLOWBITE_PAGINATION_CURRENT_PAGE_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_BUTTON_PROPERTIES_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_CUSTOM_STYLE_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_PREVIOUS_ICON_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_NEXT_ICON_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_FIRST_ICON_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_LAST_ICON_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_TABS_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_PAGE_SIZE_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_HAS_FIRST_LAST_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_HAS_PREV_NEXT_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_NAVIGATION_MODE_DEFAULT_VALUE, | ||
| FLOWBITE_PAGINATION_SIZE_DEFAULT_VALUE, | ||
| } from './pagination.component'; | ||
| export type { PaginationProperties, PaginationClass, PaginationTheme } from './pagination.theme'; | ||
| export { paginationTheme } from './pagination.theme'; | ||
| export { | ||
| PaginationThemeService, | ||
| FLOWBITE_PAGINATION_THEME_TOKEN, | ||
| } from './pagination.theme.service'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "lib": { | ||
| "entryFile": "./index.ts" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add a dedicated property and event emitter for page changes.
This example references the pagination component but does not display how to handle page changes. To make the documentation more instructive, you might add a property like “page: number = 1” and subscribe to the (pageChange) event for demonstration.