Skip to content

Commit

Permalink
Hide pagination buttons when this.totalPages = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
destyk committed Sep 17, 2022
1 parent eac108a commit 6ae9f87
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ class Pagination {
row = [];

// Pagination Controls
row.push(getButton(this.messages.prev, `${this._callbackStr}-prev`));
if (this.isEnabledDeleteButton) {
row.push(getButton(this.messages.delete, `${this._callbackStr}-delete`));
if (this.totalPages > 1) {
row.push(getButton(this.messages.prev, `${this._callbackStr}-prev`));
if (this.isEnabledDeleteButton) {
row.push(getButton(this.messages.delete, `${this._callbackStr}-delete`));
}
row.push(getButton(this.messages.next, `${this._callbackStr}-next`));
keyboard.push(row);
}
row.push(getButton(this.messages.next, `${this._callbackStr}-next`));
keyboard.push(row);

// If needed add custom buttons
if (this.inlineCustomButtons && typeof this.inlineCustomButtons === 'object') {
Expand Down

0 comments on commit 6ae9f87

Please sign in to comment.