From 82bf86aa0eaa82736dc4cdc46dc4f3a3ee4843a0 Mon Sep 17 00:00:00 2001 From: BFlat Date: Fri, 23 Feb 2024 12:44:11 +0700 Subject: [PATCH] selection bubble fix --- .../common/SelectionBubbles/SelectionBubbles.tsx | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx b/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx index d950521ab1..18213ba178 100644 --- a/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx +++ b/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx @@ -43,26 +43,12 @@ export default function SelectionBubbles({ if (bubblesRef.current) { const { scrollLeft, scrollWidth, clientWidth } = bubblesRef.current; const isAtEnd = scrollWidth - Math.round(scrollLeft + clientWidth) <= 1; - const isAtStart = scrollLeft <= 1; // Check if at the start + const isAtStart = scrollLeft <= 1; setShowGradient(!isAtEnd); setShowLeftGradient(!isAtStart); } }; - const checkForOverflowContent = () => { - if (bubblesRef.current) { - const { scrollWidth, clientWidth } = bubblesRef.current; - const isOverflowing = scrollWidth > clientWidth; - setShowGradient(isOverflowing); - } - }; - - useEffect(() => { - checkForOverflowContent(); - window.addEventListener("resize", checkForOverflowContent); - return () => window.removeEventListener("resize", checkForOverflowContent); - }, [options]); - useEffect(() => { if (bubblesRef.current) { bubblesRef.current.addEventListener("scroll", handleScroll);