@@ -39,6 +39,14 @@ function BubbleBackground({
3939 } ,
4040 ...props
4141} : BubbleBackgroundProps ) {
42+ const [ isMobile , setIsMobile ] = React . useState ( false ) ;
43+ React . useEffect ( ( ) => {
44+ console . log ( window . innerWidth ) ;
45+ if ( window . innerWidth < 768 ) {
46+ setIsMobile ( true ) ;
47+ }
48+ } , [ ] ) ;
49+
4250 const containerRef = React . useRef < HTMLDivElement > ( null ) ;
4351 React . useImperativeHandle ( ref , ( ) => containerRef . current as HTMLDivElement ) ;
4452
@@ -48,7 +56,7 @@ function BubbleBackground({
4856 const springY = useSpring ( mouseY , transition ) ;
4957
5058 React . useEffect ( ( ) => {
51- if ( ! interactive ) return ;
59+ if ( ! interactive || isMobile ) return ;
5260
5361 const currentContainer = containerRef . current ;
5462 if ( ! currentContainer ) return ;
@@ -64,7 +72,7 @@ function BubbleBackground({
6472 currentContainer ?. addEventListener ( "mousemove" , handleMouseMove ) ;
6573 return ( ) =>
6674 currentContainer ?. removeEventListener ( "mousemove" , handleMouseMove ) ;
67- } , [ interactive , mouseX , mouseY ] ) ;
75+ } , [ interactive , mouseX , mouseY , isMobile ] ) ;
6876
6977 return (
7078 < div
@@ -92,6 +100,7 @@ function BubbleBackground({
92100 < svg
93101 xmlns = "http://www.w3.org/2000/svg"
94102 className = "absolute top-0 left-0 h-0 w-0"
103+ style = { { transform : "translate3d(0, 0, 0)" } }
95104 >
96105 < defs >
97106 < filter id = "goo" >
@@ -113,7 +122,10 @@ function BubbleBackground({
113122
114123 < div
115124 className = "absolute inset-0"
116- style = { { filter : "url(#goo) blur(40px)" } }
125+ style = { {
126+ filter : isMobile ? "none" : "url(#goo) blur(40px)" ,
127+ transform : "translate3d(0, 0, 0)" ,
128+ } }
117129 >
118130 < motion . div
119131 className = "absolute top-[10%] left-[10%] size-[80%] rounded-full bg-[radial-gradient(circle_at_center,rgba(var(--first-color),0.8)_0%,rgba(var(--first-color),0)_50%)] mix-blend-hard-light"
0 commit comments