Skip to content

Commit

Permalink
Validates if page is integer
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Feb 22, 2024
1 parent 109cd24 commit 61f6e08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
}
.square {
margin: 0;
padding: 0.5rem;
}
Expand Down
7 changes: 6 additions & 1 deletion src/common/Paginator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
export let has_previous = false;
export let goToNav = false;
var isInt = /^[0-9]+$/;
const dispatch = createEventDispatcher();
let input: HTMLInputElement;
// proxy the page value so we can reset it if needed
let inputValue = page;
$: inputWidth = String(inputValue ?? 0).length;
$: invalidValue = inputValue > totalPages || !inputValue;
$: invalidValue =
inputValue > totalPages ||
!inputValue ||
!isInt.test(inputValue.toString());
$: {
inputValue = page;
}
Expand Down

0 comments on commit 61f6e08

Please sign in to comment.