forked from netbirdio/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0130d2
commit a87c06e
Showing
4 changed files
with
690 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { useState } from "react"; | ||
import { storeFilterState } from "./filterState"; | ||
import {useState} from "react"; | ||
import {storeFilterState} from "./filterState"; | ||
|
||
export const usePageSizeHelpers = () => { | ||
const [pageSize, setPageSize] = useState(10); | ||
export const usePageSizeHelpers = (defaultSize = 10) => { | ||
const [pageSize, setPageSize] = useState(defaultSize); | ||
|
||
const onChangePageSize = (value: string, pageName: string) => { | ||
setPageSize(parseInt(value.toString())); | ||
storeFilterState(pageName, "pageSize", parseInt(value.toString())); | ||
}; | ||
const onChangePageSize = (value: string, pageName: string) => { | ||
setPageSize(parseInt(value.toString())); | ||
storeFilterState(pageName, "pageSize", parseInt(value.toString())); | ||
}; | ||
|
||
const pageSizeOptions = [ | ||
{ label: "10", value: "10" }, | ||
{ label: "25", value: "25" }, | ||
{ label: "50", value: "50" }, | ||
{ label: "100", value: "100" }, | ||
{ label: "1000", value: "1000" }, | ||
]; | ||
const pageSizeOptions = [ | ||
{label: "10", value: "10"}, | ||
{label: "25", value: "25"}, | ||
{label: "50", value: "50"}, | ||
{label: "100", value: "100"}, | ||
{label: "1000", value: "1000"}, | ||
]; | ||
|
||
return { | ||
onChangePageSize, | ||
pageSize, | ||
pageSizeOptions, | ||
}; | ||
return { | ||
onChangePageSize, | ||
pageSize, | ||
pageSizeOptions, | ||
}; | ||
}; |
Oops, something went wrong.