Skip to content

Commit

Permalink
add smaller pagination variant for small sections even on large screens
Browse files Browse the repository at this point in the history
  • Loading branch information
0x1DEA committed Sep 10, 2024
1 parent ca93823 commit 164ee5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions resources/js/Components/Pagination.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<script setup>
import {Link, router} from '@inertiajs/vue3';
import route from "ziggy-js";
import {computed} from "vue";
const props = defineProps({
list: Object
list: Object,
small: Boolean
})
// TODO: use calculation to figure out when to use small logic!!!
const promptPage = () => {
let page = prompt('Jump to page number:')
Expand Down Expand Up @@ -33,9 +36,11 @@ const promptPage = () => {
<template v-for="(link, index) in list.links.slice(1, -1)">
<span v-if="link.label === '...'" @click="promptPage" class="cursor-pointer hover:text-ui-500" title="Jump to specific page">{{ link.label }}</span>
<template v-else>
<Link v-if="list.links[index + 2].label === '...' || list.links[index].label === '...'" :href="link.url" class="hidden sm:inline px-2 transition-colors hover:text-ui-500" :class="{'bg-ui-700': link.active}">
{{ link.label }}
</Link>
<template v-if="list.links[index + 2].label === '...' || list.links[index].label === '...'">
<Link v-if="!small" :href="link.url" class="hidden sm:inline px-2 transition-colors hover:text-ui-500" :class="{'bg-ui-700': link.active}">
{{ link.label }}
</Link>
</template>
<Link v-else :href="link.url" class="px-2 transition-colors hover:text-ui-500" :class="{'bg-ui-700': link.active}">
{{ link.label }}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Users/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const tab = ref(0);
</div>
<p class="text-sm">{{ review.review }}</p>
</Link>
<Pagination class="py-2" :list="reviews"/>
<Pagination class="py-2" :list="reviews" :small="true"/>
</div>
</div>
</div>
Expand Down

0 comments on commit 164ee5e

Please sign in to comment.