Skip to content

Commit c54d7da

Browse files
committed
Minor fixes to docs
1 parent cffe109 commit c54d7da

File tree

3 files changed

+43
-13
lines changed

3 files changed

+43
-13
lines changed

src/App.vue

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<p class="text-secondary">
1919
This component provides a basic styles for pagination and a minimalistic design. This pagination can be used for paginate tables, data lists, etc.
2020
</p>
21+
<p class="text-center">
22+
<tiny-pagination
23+
:total="3000"
24+
custom-class="tiny-white"></tiny-pagination>
25+
</p>
2126
</div>
2227
</div>
2328
</div>
@@ -29,8 +34,6 @@
2934
<pre class="code" data-lang="Bash"><code><span class="tag">$</span>npm install <span class="atv">vue-tiny-pagination</span> --save</code></pre>
3035
<p class="h5">Install with Yarn</p>
3136
<pre class="code" data-lang="Bash"><code><span class="tag">$</span>yarn add <span class="atv">vue-tiny-pagination</span></code></pre>
32-
<p class="h5">Install with Bower</p>
33-
<pre class="code" data-lang="Bash"><code><span class="tag">$</span>bower install <span class="atv">vue-tiny-pagination</span></code></pre>
3437
<br>
3538
<h2>Basic usage</h2>
3639
<pre class="code" data-lang="HTML"><code>&lt;<span class="tag">div</span> id=<span class="atv">"app"</span>&gt;
@@ -93,7 +96,8 @@
9396
<tiny-pagination
9497
:total="currentTotal"
9598
custom-class="custom-tiny-class"
96-
@tiny:change-page="changePage"></tiny-pagination>
99+
@tiny:change-page="changePage"
100+
@tiny:change-limit="changeLimit"></tiny-pagination>
97101
</div>
98102
<br>
99103
<kbd>Current page: {{currentPage}}</kbd>
@@ -125,7 +129,7 @@
125129
<td>page</td>
126130
<td>Number</td>
127131
<td>1</td>
128-
<td>A number for set a default page.</td>
132+
<td>Prop to set a default page.</td>
129133
</tr>
130134
<tr>
131135
<td>lang</td>
@@ -136,8 +140,14 @@
136140
<tr>
137141
<td>customClass</td>
138142
<td>String</td>
139-
<td></td>
140-
<td>A prop for set a custom class.</td>
143+
<td>""</td>
144+
<td>Prop to set a custom class.</td>
145+
</tr>
146+
<tr>
147+
<td>limits</td>
148+
<td>Array</td>
149+
<td>[10, 15, 20, 50, 100]</td>
150+
<td>Prop to set a default limits to page sizes.</td>
141151
</tr>
142152
</tbody>
143153
</table>
@@ -159,6 +169,10 @@
159169
<td>tiny:change-page</td>
160170
<td>Get the current page from pagination <code>payload: {page: 1}</code>.</td>
161171
</tr>
172+
<tr>
173+
<td>tiny:change-limit</td>
174+
<td>Get the current limit from pagination <code>payload: {limit: 10}</code>.</td>
175+
</tr>
162176
</tbody>
163177
</table>
164178
</div>
@@ -179,6 +193,7 @@
179193
<p class="tile-title"><span class="text-primary">[v0.1.0]</span> Initial commit and first release.</p>
180194
<p class="tile-title"><span class="text-primary">[v0.1.1]</span> Updated typo on README.md.</p>
181195
<p class="tile-title"><span class="text-primary">[v0.1.2]</span> Changed default pageSize from <code>15 to 10</code>. Added cursor <code>not-allowed</code> for disabled page-items.</p>
196+
<p class="tile-title"><span class="text-primary">[v0.2.1]</span> Added prop for items per page and event for <code>$emit</code> the current limit (<code>payload: {limit: 10}</code>). Added testing for minor functionality.</p>
182197
</div>
183198
</div>
184199
</div>
@@ -204,6 +219,7 @@ export default {
204219
return {
205220
currentTotal: 0,
206221
currentPage: 1,
222+
currentLimit: 10,
207223
message: "A Vue component for create tiny pagination",
208224
users: [],
209225
error: {
@@ -216,9 +232,9 @@ export default {
216232
this.getData(this.currentPage)
217233
},
218234
methods: {
219-
getData (page) {
235+
getData (page, limit) {
220236
this.error.status = false
221-
getUsers(page).then((response) => {
237+
getUsers(page, limit).then((response) => {
222238
this.users = response.data.data
223239
this.currentTotal = response.data.total
224240
}).catch((err) => {
@@ -228,7 +244,11 @@ export default {
228244
},
229245
changePage(pagination) {
230246
this.currentPage = pagination.page
231-
this.getData(this.currentPage)
247+
this.getData(this.currentPage, this.currentLimit)
248+
},
249+
changeLimit (payload) {
250+
this.currentLimit = payload.limit
251+
this.getData(this.currentPage, this.currentLimit)
232252
}
233253
},
234254
components: {

src/_scss/_docs.scss

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ kbd {
99

1010
.version {
1111
&::after {
12-
content: '0.1.2'
12+
content: '0.2.1'
1313
}
1414
}
1515

@@ -72,6 +72,16 @@ kbd {
7272
// Section features
7373
.section-features {
7474
padding: 4.5rem .5rem;
75+
.tiny-pagination {
76+
&.tiny-white {
77+
justify-content: center;
78+
.page-item {
79+
a {
80+
color: #f8f9fa;
81+
}
82+
}
83+
}
84+
}
7585
}
7686

7787
// Section usage
@@ -82,8 +92,8 @@ kbd {
8292
border-radius: 5px;
8393
}
8494
.tiny-pagination {
85-
justify-content: space-between;
8695
&.custom-tiny-class {
96+
justify-content: space-between;
8797
.page-item {
8898
&.disabled {
8999
a {

src/services/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ const API_URL = `https://reqres.in/api`
66
* @param {Number} page
77
* @return AxiosPromise
88
*/
9-
export const getUsers = (page = 1) => {
10-
return axios.get(`${API_URL}/users?per_page=10&page=${page}`)
9+
export const getUsers = (page = 1, limit = 10) => {
10+
return axios.get(`${API_URL}/users?per_page=${limit}&page=${page}`)
1111
}

0 commit comments

Comments
 (0)