diff --git a/app/components/Sharing/components/Suggestions.tsx b/app/components/Sharing/components/Suggestions.tsx index 43f807c259..516c159b36 100644 --- a/app/components/Sharing/components/Suggestions.tsx +++ b/app/components/Sharing/components/Suggestions.tsx @@ -70,7 +70,7 @@ export const Suggestions = observer( const containerRef = React.useRef(null); const maxHeight = useMaxHeight({ elementRef: containerRef, - maxViewportHeight: 70, + maxViewportPercentage: 70, }); const fetchUsersByQuery = useThrottledCallback( diff --git a/app/hooks/useMaxHeight.ts b/app/hooks/useMaxHeight.ts index 4aa3fa7574..9fa0c86928 100644 --- a/app/hooks/useMaxHeight.ts +++ b/app/hooks/useMaxHeight.ts @@ -4,11 +4,11 @@ import useWindowSize from "./useWindowSize"; const useMaxHeight = ({ elementRef, - maxViewportHeight = 90, - margin = 8, + maxViewportPercentage = 90, + margin = 16, }: { /** The maximum height of the element as a percentage of the viewport. */ - maxViewportHeight?: number; + maxViewportPercentage?: number; /** A ref pointing to the element. */ elementRef?: React.RefObject; /** The margin to apply to the positioning. */ @@ -20,7 +20,7 @@ const useMaxHeight = ({ React.useLayoutEffect(() => { if (!isMobile && elementRef?.current) { - const mxHeight = (windowHeight / 100) * maxViewportHeight; + const mxHeight = (windowHeight / 100) * maxViewportPercentage; setMaxHeight( Math.min( @@ -35,7 +35,7 @@ const useMaxHeight = ({ } else { setMaxHeight(0); } - }, [elementRef, windowHeight, margin, isMobile, maxViewportHeight]); + }, [elementRef, windowHeight, margin, isMobile, maxViewportPercentage]); return maxHeight; };