Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert change for table pagination text adjustment on small screen #1040

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading