610c86837a
figma: https://www.figma.com/file/ZJNAFHCAq6rnuGRgUFxjzQ/Organizations----New-features?type=design&node-id=4304-330348&mode=design&t=nKonHZpucwxnqwQI-4 (Not all features are in this PR) loom: https://www.loom.com/share/30e8ef20a5b34a708dca160d8c04ae6f shoutout @shadcn for the base of this table <3 Member View: ![CleanShot 2023-07-14 at 14 09 02](https://github.com/calcom/cal.com/assets/55134778/5db6eedb-bece-4955-91f0-9f2b3b042300) Admin view: ![CleanShot 2023-07-14 at 14 09 07](https://github.com/calcom/cal.com/assets/55134778/708c624d-1990-4075-8b32-d4587d09deff) How to test - Create ORG - add members - view settings -> orgs -> members
29 lines
572 B
TypeScript
29 lines
572 B
TypeScript
import type { PaginationState } from "@tanstack/react-table";
|
|
import { useState, useMemo } from "react";
|
|
|
|
export function usePagination({
|
|
defaultPageIndex = 1,
|
|
defaultPageSize = 20,
|
|
}: {
|
|
defaultPageIndex?: number;
|
|
defaultPageSize?: number;
|
|
}) {
|
|
const [{ pageIndex, pageSize }, setPagination] = useState<PaginationState>({
|
|
pageIndex: defaultPageIndex,
|
|
pageSize: defaultPageSize,
|
|
});
|
|
|
|
const pagination = useMemo(
|
|
() => ({
|
|
pageIndex,
|
|
pageSize,
|
|
}),
|
|
[pageIndex, pageSize]
|
|
);
|
|
|
|
return {
|
|
pagination,
|
|
setPagination,
|
|
};
|
|
}
|