-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Pagination): new component (#257)
Co-authored-by: Benjamin Canac <canacb1@gmail.com> Co-authored-by: Haytham A. Salama <haythamasalama@gmail.com>
- Loading branch information
1 parent
f7a34c8
commit f0b24ba
Showing
11 changed files
with
625 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script setup> | ||
const page = ref(1) | ||
const items = ref(Array(55)) | ||
</script> | ||
|
||
<template> | ||
<UPagination v-model="page" :page-count="5" :total="items.length" /> | ||
</template> |
20 changes: 20 additions & 0 deletions
20
docs/components/content/examples/PaginationExamplePrevNextSlots.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script setup> | ||
const page = ref(1) | ||
const items = ref(Array(55)) | ||
</script> | ||
|
||
<template> | ||
<UPagination v-model="page" :total="items.length" :ui="{ rounded: 'first-of-type:rounded-l-md last-of-type:rounded-r-md' }"> | ||
<template #prev="{ onClick }"> | ||
<UTooltip text="Previous page"> | ||
<UButton icon="i-heroicons-arrow-small-left-20-solid" color="primary" :ui="{ rounded: 'rounded-full' }" class="mr-2" @click="onClick" /> | ||
</UTooltip> | ||
</template> | ||
|
||
<template #next="{ onClick }"> | ||
<UTooltip text="Next page"> | ||
<UButton icon="i-heroicons-arrow-small-right-20-solid" color="primary" :ui="{ rounded: 'rounded-full' }" class="ml-2" @click="onClick" /> | ||
</UTooltip> | ||
</template> | ||
</UPagination> | ||
</template> |
98 changes: 98 additions & 0 deletions
98
docs/components/content/examples/TableExamplePaginable.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<script setup> | ||
const people = [{ | ||
id: 1, | ||
name: 'Lindsay Walton', | ||
title: 'Front-end Developer', | ||
email: 'lindsay.walton@example.com', | ||
role: 'Member' | ||
}, { | ||
id: 2, | ||
name: 'Courtney Henry', | ||
title: 'Designer', | ||
email: 'courtney.henry@example.com', | ||
role: 'Admin' | ||
}, { | ||
id: 3, | ||
name: 'Tom Cook', | ||
title: 'Director of Product', | ||
email: 'tom.cook@example.com', | ||
role: 'Member' | ||
}, { | ||
id: 4, | ||
name: 'Whitney Francis', | ||
title: 'Copywriter', | ||
email: 'whitney.francis@example.com', | ||
role: 'Admin' | ||
}, { | ||
id: 5, | ||
name: 'Leonard Krasner', | ||
title: 'Senior Designer', | ||
email: 'leonard.krasner@example.com', | ||
role: 'Owner' | ||
}, { | ||
id: 6, | ||
name: 'Floyd Miles', | ||
title: 'Principal Designer', | ||
email: 'floyd.miles@example.com', | ||
role: 'Member' | ||
}, { | ||
id: 7, | ||
name: 'Emily Selman', | ||
title: 'VP, User Experience', | ||
email: '', | ||
role: 'Admin' | ||
}, { | ||
id: 8, | ||
name: 'Kristin Watson', | ||
title: 'VP, Human Resources', | ||
email: '', | ||
role: 'Member' | ||
}, { | ||
id: 9, | ||
name: 'Emma Watson', | ||
title: 'Front-end Developer', | ||
email: '', | ||
role: 'Member' | ||
}, { | ||
id: 10, | ||
name: 'John Doe', | ||
title: 'Designer', | ||
email: '', | ||
role: 'Admin' | ||
}, { | ||
id: 11, | ||
name: 'Jane Doe', | ||
title: 'Director of Product', | ||
email: '', | ||
role: 'Member' | ||
}, { | ||
id: 12, | ||
name: 'John Smith', | ||
title: 'Copywriter', | ||
email: '', | ||
role: 'Admin' | ||
}, { | ||
id: 13, | ||
name: 'Jane Smith', | ||
title: 'Senior Designer', | ||
email: '', | ||
role: 'Owner' | ||
}] | ||
const page = ref(1) | ||
const pageCount = 5 | ||
const rows = computed(() => { | ||
return people.slice((page.value - 1) * pageCount, (page.value) * pageCount) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<UTable :rows="rows" /> | ||
|
||
<div class="flex justify-end px-3 py-3.5 border-t border-gray-200 dark:border-gray-700"> | ||
<UPagination v-model="page" :page-count="pageCount" :total="people.length" /> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup> | ||
const page = ref(1) | ||
const items = ref(Array(55)) | ||
</script> | ||
|
||
<template> | ||
<UPagination | ||
v-model="page" | ||
:total="items.length" | ||
:ui="{ | ||
wrapper: 'flex items-center gap-1', | ||
rounded: 'rounded-full min-w-[32px] justify-center' | ||
}" | ||
:prev-button="null" | ||
:next-button="{ | ||
icon: 'i-heroicons-arrow-small-right-20-solid', | ||
color: 'primary', | ||
variant: 'outline' | ||
}" | ||
/> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f0b24ba
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.
Successfully deployed to the following URLs:
ui – ./
ui.nuxtlabs.com
ui-nuxtlabs.vercel.app
ui-git-dev-nuxtlabs.vercel.app