From 0ba7e5c3486cc1c7a3a42aeb6ca06deea1eb2436 Mon Sep 17 00:00:00 2001 From: Titani Labaj <39532947+tlabaj@users.noreply.github.com> Date: Fri, 3 May 2024 11:14:32 -0400 Subject: [PATCH] "fix(Pagination): Fix bottom pagination layout" (#10315) * fix(Pgination): Fix bottom pagination layout * fix(Pgination): Fix bottom pagination layout --- .../src/components/Pagination/Pagination.tsx | 2 + .../Pagination/PaginationOptionsMenu.tsx | 27 +- .../PaginationOptionsMenu.test.tsx.snap | 74 +- .../__snapshots__/Pagination.test.tsx.snap | 1468 ++++++++--------- 4 files changed, 765 insertions(+), 806 deletions(-) diff --git a/packages/react-core/src/components/Pagination/Pagination.tsx b/packages/react-core/src/components/Pagination/Pagination.tsx index f4c412da26e..6f8451d47e1 100644 --- a/packages/react-core/src/components/Pagination/Pagination.tsx +++ b/packages/react-core/src/components/Pagination/Pagination.tsx @@ -232,6 +232,7 @@ export const Pagination: React.FunctionComponent = ({ ...props }: PaginationProps) => { const paginationRef = React.useRef(null); + const containerRef = React.useRef(null); const getLastPage = () => // when itemCount is not known let's set lastPage as page+1 as we don't know the total count @@ -335,6 +336,7 @@ export const Pagination: React.FunctionComponent = ({ widgetId={`${widgetId}-${variant}`} toggleTemplate={toggleTemplate} isDisabled={isDisabled} + containerRef={containerRef} /> )} ; } export const PaginationOptionsMenu: React.FunctionComponent = ({ @@ -74,12 +75,12 @@ export const PaginationOptionsMenu: React.FunctionComponent null as any + onPerPageSelect = () => null as any, + containerRef }: PaginationOptionsMenuProps) => { const [isOpen, setIsOpen] = React.useState(false); const toggleRef = React.useRef(null); const menuRef = React.useRef(null); - const containerRef = React.useRef(null); const onToggle = () => { setIsOpen((prevState) => !prevState); @@ -208,18 +209,16 @@ export const PaginationOptionsMenu: React.FunctionComponent - - + ); }; diff --git a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap index 1167a78ce3f..2318ccc5400 100644 --- a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap @@ -2,48 +2,46 @@ exports[`PaginationOptionsMenu should match snapshot (auto-generated) 1`] = ` -
- -
+ +
`; diff --git a/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap index 242c3a314d0..4b903de5555 100644 --- a/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap @@ -22,49 +22,47 @@ exports[`Pagination API verify inset2xl inset breakpoints 1`] = ` -
- -
+ +