Skip to content

Commit

Permalink
fix: revert change for table pagination text adjustment on small screen
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Hu <[email protected]>
  • Loading branch information
mas-who committed Feb 8, 2024
1 parent f2f84f8 commit 432966b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/TablePagination/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ import {
useState,
} from "react";

/**
* Determine if we are working with a small screen.
* 'small screen' in this case is relative to the width of the description div
*/
export const figureSmallScreen = () => {
const descriptionElement = document.getElementById("pagination-description");
if (!descriptionElement) {
return true;
}
return descriptionElement.getBoundingClientRect().width < 230;
};

/**
* Iterate direct react child components and override the value of the prop specified by @param dataForwardProp
* for those child components.
Expand Down Expand Up @@ -67,7 +79,7 @@ export const useFigureSmallScreen = () => {
const [isSmallScreen, setSmallScreen] = useState(false);
useEffect(() => {
const handleResize = () => {
setSmallScreen(window.innerWidth < 620);
setSmallScreen(figureSmallScreen());
};
window.addEventListener("resize", handleResize);
return () => {
Expand Down

0 comments on commit 432966b

Please sign in to comment.