Skip to content

Commit

Permalink
refactor: alphabetize props
Browse files Browse the repository at this point in the history
  • Loading branch information
jordankoschei-okta committed Jul 18, 2024
1 parent a9f63ba commit e6bcf99
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
88 changes: 44 additions & 44 deletions packages/odyssey-react-mui/src/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,37 @@ const PaginationButtonContainer = styled("div")({

export type PaginationProps = {
/**
* The current page index
* The labeled rendered for the current page index
*/
pageIndex: number;
currentPageLabel: string;
/**
* The current page size
* If true, the pagination controls will be disabled
*/
pageSize: number;
isDisabled?: boolean;
/**
* The max rows per page
* If true, the next or Show More button will be disabled
*/
maxPageSize?: number;
isMoreDisabled?: boolean;
/**
* The current page last row index
*/
lastRow: number;
/**
* If the pagination is of "loadMore" variant, then this is the the load more label
*/
loadMoreLabel: string;
/**
* The max page
*/
maxPageIndex?: number;
/**
* The max rows per page
*/
maxPageSize?: number;
/**
* The label for the next control
*/
nextLabel: string;
/**
* Page index and page size setter
*/
Expand All @@ -92,64 +108,48 @@ export type PaginationProps = {
pageSize: number;
}) => void;
/**
* The current page last row index
*/
lastRow: number;
/**
* Total rows count
*/
totalRows?: number;
/**
* If true, the pagination controls will be disabled
* The current page index
*/
isDisabled?: boolean;
pageIndex: number;
/**
* If true, the next or Show More button will be disabled
* The current page size
*/
isMoreDisabled?: boolean;
pageSize: number;
/**
* The type of pagination controls shown. Defaults to next/prev buttons, but can be
* set to a simple "Load more" button by setting to "loadMore".
* The label for the previous control
*/
variant?: (typeof paginationTypeValues)[number];
previousLabel: string;
/**
* The label that shows how many results are rendered per page
*/
rowsPerPageLabel: string;
/**
* The labeled rendered for the current page index
*/
currentPageLabel: string;
/**
* The label for the previous control
*/
previousLabel: string;
/**
* The label for the next control
* Total rows count
*/
nextLabel: string;
totalRows?: number;
/**
* If the pagination is of "loadMore" variant, then this is the the load more label
* The type of pagination controls shown. Defaults to next/prev buttons, but can be
* set to a simple "Load more" button by setting to "loadMore".
*/
loadMoreLabel: string;
variant?: (typeof paginationTypeValues)[number];
};

const Pagination = ({
pageIndex,
pageSize,
maxPageSize,
currentPageLabel,
isDisabled,
isMoreDisabled,
lastRow,
loadMoreLabel,
maxPageIndex,
maxPageSize,
nextLabel,
onPaginationChange,
lastRow,
pageIndex,
pageSize,
previousLabel,
rowsPerPageLabel,
totalRows,
isDisabled,
isMoreDisabled,
variant,
rowsPerPageLabel,
currentPageLabel,
previousLabel,
nextLabel,
loadMoreLabel,
}: PaginationProps) => {
const odysseyDesignTokens = useOdysseyDesignTokens();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ const DataStack = ({
isPaginationMoreDisabled,
isRowReorderingDisabled,
maxGridColumns,
maxPages,
maxResultsPerPage,
noResultsPlaceholder,
onChangeRowSelection,
paginationType,
resultsPerPage,
rowActionMenuItems,
searchDelayTime,
totalRows,
maxPages,
maxResultsPerPage,
}: DataStackProps) => {
const stackOptions = useMemo(
() => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const DataTable = ({
isNoResults,
isPaginationMoreDisabled,
isRowReorderingDisabled,
maxResultsPerPage,
maxPages,
noResultsPlaceholder,
onChangeRowSelection,
paginationType,
Expand All @@ -50,8 +52,6 @@ const DataTable = ({
rowActionMenuItems,
searchDelayTime,
totalRows,
maxResultsPerPage,
maxPages,
}: DataTableProps) => {
const tableOptions = useMemo(
() => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ const DataView = ({
isMoreDisabled={isPaginationMoreDisabled}
lastRow={lastRowOnPage}
loadMoreLabel={t("pagination.loadmore")}
maxPageIndex={maxPages}
maxPageSize={maxResultsPerPage}
nextLabel={t("pagination.next")}
onPaginationChange={setPagination}
pageIndex={pagination.pageIndex}
Expand All @@ -394,8 +396,6 @@ const DataView = ({
rowsPerPageLabel={t("pagination.rowsperpage")}
totalRows={totalRows}
variant={paginationType}
maxPageIndex={maxPages}
maxPageSize={maxResultsPerPage}
/>
)}
</DataViewContainer>
Expand Down

0 comments on commit e6bcf99

Please sign in to comment.