From 1f5da4be9261ba5a23c0de6bcfd015aeba86d3ee Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 21 Dec 2022 20:42:49 +0400 Subject: [PATCH 1/4] feat: added basic pagination --- .../pagination/examples/PaginationExample.vue | 7 +- src/components/Pagination/Pagination.vue | 87 ++++++++++++++----- src/components/Pagination/types.ts | 1 + 3 files changed, 71 insertions(+), 24 deletions(-) create mode 100644 src/components/Pagination/types.ts diff --git a/docs/components/pagination/examples/PaginationExample.vue b/docs/components/pagination/examples/PaginationExample.vue index 548b3f3..a559591 100644 --- a/docs/components/pagination/examples/PaginationExample.vue +++ b/docs/components/pagination/examples/PaginationExample.vue @@ -1,8 +1,11 @@ - diff --git a/src/components/Pagination/Pagination.vue b/src/components/Pagination/Pagination.vue index 6df6137..863b4fd 100644 --- a/src/components/Pagination/Pagination.vue +++ b/src/components/Pagination/Pagination.vue @@ -2,50 +2,93 @@ diff --git a/src/components/Pagination/types.ts b/src/components/Pagination/types.ts new file mode 100644 index 0000000..15bf6b6 --- /dev/null +++ b/src/components/Pagination/types.ts @@ -0,0 +1 @@ +export type PaginationLayout = 'navigation' | 'pagination' | 'table' From e3ac782c1b7fee8e7d95aebefe5ad7978d8bb5f7 Mon Sep 17 00:00:00 2001 From: victor Date: Fri, 23 Dec 2022 16:54:30 +0400 Subject: [PATCH 2/4] feat: added table layout --- docs/components/pagination.md | 32 ++++++- .../pagination/examples/PaginationExample.vue | 2 +- .../examples/PaginationNavigationExample.vue | 11 +++ .../examples/PaginationTableExample.vue | 16 ++++ src/components/Pagination/Pagination.vue | 84 +++++++++++++++++-- 5 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 docs/components/pagination/examples/PaginationNavigationExample.vue create mode 100644 docs/components/pagination/examples/PaginationTableExample.vue diff --git a/docs/components/pagination.md b/docs/components/pagination.md index c4388f2..989472a 100644 --- a/docs/components/pagination.md +++ b/docs/components/pagination.md @@ -1,8 +1,12 @@ # Vue Pagination Component - Flowbite +## Default pagination + ```vue + +``` + + + +## Pagination with table layout + +```vue + + +``` + + diff --git a/docs/components/pagination/examples/PaginationExample.vue b/docs/components/pagination/examples/PaginationExample.vue index a559591..845de13 100644 --- a/docs/components/pagination/examples/PaginationExample.vue +++ b/docs/components/pagination/examples/PaginationExample.vue @@ -1,6 +1,6 @@ diff --git a/docs/components/pagination/examples/PaginationTableExample.vue b/docs/components/pagination/examples/PaginationTableExample.vue new file mode 100644 index 0000000..5660d0b --- /dev/null +++ b/docs/components/pagination/examples/PaginationTableExample.vue @@ -0,0 +1,16 @@ + + diff --git a/src/components/Pagination/Pagination.vue b/src/components/Pagination/Pagination.vue index 863b4fd..42f59a9 100644 --- a/src/components/Pagination/Pagination.vue +++ b/src/components/Pagination/Pagination.vue @@ -1,5 +1,13 @@ ``` - + + +## Pagination with icons + +```vue + + +``` + + + +## Pagination with custom labels + +```vue + + +``` diff --git a/docs/components/pagination/examples/PaginationWithCustomTextExample.vue b/docs/components/pagination/examples/PaginationWithCustomTextExample.vue new file mode 100644 index 0000000..2553685 --- /dev/null +++ b/docs/components/pagination/examples/PaginationWithCustomTextExample.vue @@ -0,0 +1,11 @@ + + diff --git a/docs/components/pagination/examples/PaginationWithIconsExample.vue b/docs/components/pagination/examples/PaginationWithIconsExample.vue new file mode 100644 index 0000000..aaead23 --- /dev/null +++ b/docs/components/pagination/examples/PaginationWithIconsExample.vue @@ -0,0 +1,11 @@ + + diff --git a/src/components/Pagination/Pagination.vue b/src/components/Pagination/Pagination.vue index 42f59a9..6c1158a 100644 --- a/src/components/Pagination/Pagination.vue +++ b/src/components/Pagination/Pagination.vue @@ -13,8 +13,9 @@ @@ -35,9 +36,10 @@ From 6580c65be3c4e7cd5db582620846e078fab5335b Mon Sep 17 00:00:00 2001 From: victor Date: Fri, 23 Dec 2022 17:25:45 +0400 Subject: [PATCH 4/4] doc: updated doc --- docs/.vitepress/config.ts | 2 +- docs/components/pagination.md | 64 ++++++++++++++++--- .../pagination/examples/PaginationExample.vue | 2 +- .../examples/PaginationTableExample.vue | 2 +- .../examples/PaginationWithCustomSlice.vue | 11 ++++ src/components/Pagination/Pagination.vue | 2 +- 6 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 docs/components/pagination/examples/PaginationWithCustomSlice.vue diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index fe1830a..649fdf6 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -44,6 +44,7 @@ function getComponents() { { text: 'Card', link: 'components/card.md' }, { text: 'Carousel', link: 'components/carousel' }, { text: 'Dropdown', link: '/components/dropdown' }, + { text: 'Pagination', link: 'components/pagination' }, { text: 'Progress', link: 'components/progress' }, { text: 'Rating', link: 'components/rating' }, { text: 'Spinner', link: '/components/spinner' }, @@ -57,7 +58,6 @@ function getComponents() { { text: 'Navbar', link: 'components/navbar' }, { text: '- Footer', link: 'components/footer' }, - { text: '- Pagination', link: 'components/pagination' }, { text: '- Sidebar', link: 'components/sidebar' }, ] } diff --git a/docs/components/pagination.md b/docs/components/pagination.md index cdeea44..f752709 100644 --- a/docs/components/pagination.md +++ b/docs/components/pagination.md @@ -4,6 +4,7 @@ import PaginationNavigationExample from './pagination/examples/PaginationNavigat import PaginationTableExample from './pagination/examples/PaginationTableExample.vue'; import PaginationWithIconsExample from './pagination/examples/PaginationWithIconsExample.vue'; import PaginationWithCustomTextExample from './pagination/examples/PaginationWithCustomTextExample.vue'; +import PaginationWithCustomSlice from './pagination/examples/PaginationWithCustomSlice.vue'; # Vue Pagination Component - Flowbite @@ -12,60 +13,107 @@ import PaginationWithCustomTextExample from './pagination/examples/PaginationWit ```vue +``` + + +## Default with custom length +You can use your own pages count in the row by passing props: `slice-length` +This prop means left side and right side pages row slicing. In the example it has value `4`. So row length will be 4 + 1 + 4 pages - 9 pages. + +```vue + + ``` - + ## Pagination with navigation layout ```vue ``` ## Pagination with table layout +To use that layout you have to pass required props: +- `per-page`: it's items count displayed on each page. +- `total-items`: it's the total items count. + +And there you don't need to use `total-pages` prop. ```vue ``` - + ## Pagination with icons ```vue ``` - + ## Pagination with custom labels ```vue ``` + diff --git a/docs/components/pagination/examples/PaginationExample.vue b/docs/components/pagination/examples/PaginationExample.vue index 845de13..b1322db 100644 --- a/docs/components/pagination/examples/PaginationExample.vue +++ b/docs/components/pagination/examples/PaginationExample.vue @@ -1,5 +1,5 @@ diff --git a/docs/components/pagination/examples/PaginationTableExample.vue b/docs/components/pagination/examples/PaginationTableExample.vue index 5660d0b..8a3105a 100644 --- a/docs/components/pagination/examples/PaginationTableExample.vue +++ b/docs/components/pagination/examples/PaginationTableExample.vue @@ -2,8 +2,8 @@
diff --git a/docs/components/pagination/examples/PaginationWithCustomSlice.vue b/docs/components/pagination/examples/PaginationWithCustomSlice.vue new file mode 100644 index 0000000..ce14e87 --- /dev/null +++ b/docs/components/pagination/examples/PaginationWithCustomSlice.vue @@ -0,0 +1,11 @@ + + diff --git a/src/components/Pagination/Pagination.vue b/src/components/Pagination/Pagination.vue index 6c1158a..3c25526 100644 --- a/src/components/Pagination/Pagination.vue +++ b/src/components/Pagination/Pagination.vue @@ -79,7 +79,7 @@ const props = defineProps({ }, sliceLength: { type: Number, - default: 3, + default: 2, }, previousLabel: { type: String,