From f2f84f83f9ca61fc11f607f8d7a64180e698eef4 Mon Sep 17 00:00:00 2001 From: Mason Hu Date: Wed, 7 Feb 2024 15:29:41 +0200 Subject: [PATCH] fix: table pagination description adjustments for all screen sizes [WD-8561] Signed-off-by: Mason Hu --- .../TablePaginationControls.tsx | 9 ++++--- .../TablePagination.test.tsx.snap | 3 ++- src/components/TablePagination/utils.tsx | 24 +++---------------- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx b/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx index 4716f09e6..5b129dfaf 100644 --- a/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx +++ b/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx @@ -2,7 +2,7 @@ import Button from "components/Button"; import Icon from "components/Icon"; import Input from "components/Input"; import Select from "components/Select"; -import React, { ChangeEvent, HTMLAttributes, useRef } from "react"; +import React, { ChangeEvent, HTMLAttributes } from "react"; import classnames from "classnames"; import { generatePagingOptions, @@ -38,8 +38,7 @@ const TablePaginationControls = ({ onPageSizeChange, ...divProps }: Props): JSX.Element => { - const descriptionRef = useRef(null); - const isSmallScreen = useFigureSmallScreen({ descriptionRef }); + const isSmallScreen = useFigureSmallScreen(); const totalPages = Math.ceil(totalItems / pageSize); const descriptionDisplay = getDescription({ @@ -77,7 +76,7 @@ const TablePaginationControls = ({ {...divProps} role="navigation" > -
+
{descriptionDisplay}