Skip to content

Commit 7aa33b1

Browse files
committed
Improve: Added borderActiveColor, borderTextActiveColor props
1 parent d6cf650 commit 7aa33b1

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</a>
1212
<a href="https://www.npmjs.com/package/vue-pagination-tw">
1313
<img src="https://img.shields.io/npm/dw/vue-pagination-tw" alt="Downloads" />
14-
</a>
14+
</a>
1515

1616
[![NPM](https://nodei.co/npm/vue-pagination-tw.png)](https://nodei.co/npm/vue-pagination-tw/)
1717

@@ -110,6 +110,21 @@ So this is also avaliable
110110
/>
111111
```
112112

113+
If you want to specify custom `Active Border color & text color`, you can do it like this:
114+
115+
```html
116+
<VuePaginationTw
117+
:totalItems="20"
118+
:currentPage="1"
119+
:perPage="6"
120+
@pageChanged="functionName"
121+
:goButton="false"
122+
styled="centered"
123+
borderActiveColor="border-red-500"
124+
borderTextActiveColor="text-red-500"
125+
/>
126+
```
127+
113128
#### roadmaps
114129

115130
- [ ] Make different versions of paginations (xs, md, lg, xlg)

dev/serve.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export default defineComponent({
1616
}
1717
},
1818
mounted() {
19-
// let externalScript = document.createElement('script')
20-
// externalScript.setAttribute('src', 'https://cdn.tailwindcss.com')
21-
// document.head.appendChild(externalScript)
19+
let externalScript = document.createElement('script')
20+
externalScript.setAttribute('src', 'https://cdn.tailwindcss.com')
21+
document.head.appendChild(externalScript)
2222
}
2323
});
2424
</script>
@@ -33,6 +33,8 @@ export default defineComponent({
3333
:per-page="6"
3434
@page-changed="console.log('s')"
3535
:go-button="false"
36+
borderActiveColor="border-red-500"
37+
borderTextActiveColor="text-red-500"
3638
/>
3739
</div>
3840
</div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-pagination-tw",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Simple Vue Pagination component that can be used in any project with range & ui customization.",
55
"main": "dist/vue-pagination-tw.ssr.js",
66
"browser": "dist/vue-pagination-tw.esm.js",

src/components/vue-pagination-tw.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ const props = defineProps({
3030
type: String,
3131
default: 'Go'
3232
},
33+
borderActiveColor: {
34+
type: String,
35+
default: 'border-indigo-500'
36+
},
37+
borderTextActiveColor: {
38+
type: String,
39+
default: 'text-indigo-500'
40+
},
3341
styled: {
3442
type: String,
3543
default: 'simple'
@@ -141,9 +149,10 @@ const calculatedPages = computed(() => {
141149
v-for="(page, index) in calculatedPages"
142150
:key="index"
143151
class="bg-white border border-gray-300 text-gray-500 relative inline-flex items-center px-4 py-2 text-sm font-medium"
144-
:class="{ 'z-10 bg-indigo-50 border-indigo-500 text-indigo-600': currentPage == page }"
152+
:class="{ [`z-10 bg-indigo-50 !${borderActiveColor} !${borderTextActiveColor}`]: currentPage == page }"
145153
@click.prevent="changePage(page)"
146154
>{{ page }}</a>
155+
<!-- :class="currentPage === page ? `z-10 bg-indigo-50 !${borderActiveColor} !${borderTextActiveColor}` : '' }" -->
147156
<span
148157
class="relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700"
149158
v-if="hasLast()"
@@ -197,7 +206,8 @@ const calculatedPages = computed(() => {
197206
<input
198207
type="text"
199208
placeholder="Page no"
200-
class="w-28 px-4 py-1 rounded-l outline-none border-t-2 border-l-2 border-b-2 focus:border-indigo-500 placeholder:text-xs uppercase font-semibold"
209+
class="w-28 px-4 py-1 rounded-l outline-none border-t-2 border-l-2 border-b-2 placeholder:text-xs uppercase font-semibold"
210+
:class="`focus:${borderActiveColor}`"
201211
v-model="pageInput"
202212
/>
203213
<button

0 commit comments

Comments
 (0)