Skip to content

Commit b8c3b29

Browse files
authored
Merge pull request #17 from BitTheCat/feat/add-pagination-summary-size
added size props for change summary & pagination size
2 parents ea7dd71 + 72328b0 commit b8c3b29

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

dev/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="py-8 px-8">
33
<div class="font-semibold mb-2">
4-
Tailwind Vue DataTable v0.2.6
4+
Tailwind Vue DataTable v0.2.7
55
<span class="text-xs font-light">by BitTheCat</span>
66
</div>
77
<div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitthecat/tailwind-vue-data-table",
3-
"version": "0.2.6",
3+
"version": "0.2.7",
44
"keywords": [
55
"tailwindcss",
66
"customisable",

src/components/TVPagination.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
viewBox="0 0 24 24"
88
stroke-width="1.5"
99
stroke="currentColor"
10-
class="w-3 h-3"
10+
:class="size === 'sm' ? 'w-3 h-3' : 'w-4 h-4'"
1111
@click="changePage(1)"
1212
>
1313
<path stroke-linecap="round" stroke-linejoin="round" d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5" />
@@ -20,15 +20,19 @@
2020
viewBox="0 0 24 24"
2121
stroke-width="1.5"
2222
stroke="currentColor"
23-
class="w-3 h-3"
23+
:class="size === 'sm' ? 'w-3 h-3' : 'w-4 h-4'"
2424
@click="changePage(undefined, true)"
2525
>
2626
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" />
2727
</svg>
2828
</div>
2929
<div class="sm:flex hidden">
3030
<template v-for="page of pages" :key="`page_${page}`">
31-
<p class="text-sm font-medium leading-none cursor-pointer link px-2" :class="paginationClass(page)" @click="changePage(page)">
31+
<p
32+
class="font-medium leading-none cursor-pointer link px-2"
33+
:class="`${paginationClass(page)} ${size === 'sm' ? 'text-xs' : 'text-md'}`"
34+
@click="changePage(page)"
35+
>
3236
{{ page }}
3337
</p>
3438
</template>
@@ -40,7 +44,7 @@
4044
viewBox="0 0 24 24"
4145
stroke-width="1.5"
4246
stroke="currentColor"
43-
class="w-3 h-3"
47+
:class="size === 'sm' ? 'w-3 h-3' : 'w-4 h-4'"
4448
@click="changePage(undefined)"
4549
>
4650
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
@@ -53,7 +57,7 @@
5357
viewBox="0 0 24 24"
5458
stroke-width="1.5"
5559
stroke="currentColor"
56-
class="w-3 h-3"
60+
:class="size === 'sm' ? 'w-3 h-3' : 'w-4 h-4'"
5761
@click="changePage(totPages)"
5862
>
5963
<path stroke-linecap="round" stroke-linejoin="round" d="M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5" />
@@ -83,6 +87,11 @@ const props = defineProps({
8387
type: Number,
8488
default: 1
8589
},
90+
size: {
91+
type: String,
92+
default: 'md',
93+
validator: (value) => ['sm', 'md'].includes(value)
94+
}
8695
})
8796
const emit = defineEmits(['update:currentPage'])
8897

src/components/TVTable.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div v-if="!hidePagination && totalRows != 0 && !hideSummary && !busy" class="flex items-center justify-end mr-2 mb-2 text-xs font-small text-body">
3-
<span>{{ getSummary() }}</span>
2+
<div v-if="!hidePagination && totalRows != 0 && !hideSummary && !busy" class="flex items-center justify-end mr-2 mb-2 text-body">
3+
<span :class="size === 'sm' ? 'text-xs' : 'text-md'">{{ getSummary() }}</span>
44
</div>
55

66
<div class="overflow-auto">
@@ -144,6 +144,7 @@
144144
v-model:currentPage="localCurrentPage"
145145
:total-rows="localTotalRows"
146146
:per-page="perPage"
147+
:size="size"
147148
/>
148149
</template>
149150

@@ -207,6 +208,11 @@ const props = defineProps({
207208
type: String,
208209
default: 'Displaying _STR_FROM_ to _STR_TO_ of _STR_TOTAL_ items'
209210
},
211+
size: {
212+
type: String,
213+
default: 'md',
214+
validator: (value) => ['sm', 'md'].includes(value)
215+
}
210216
})
211217
212218
const emit = defineEmits([

0 commit comments

Comments
 (0)