Skip to content

Commit 7d3eb9c

Browse files
Roystbeefterragon-labs[bot]
andcommitted
refactor(ui): conditionally render scroll indicator on non-mobile devices
The scroll indicator animation in the Hero component is now only rendered on non-mobile devices by using the useIsMobile hook. This improves performance and user experience on mobile devices by avoiding unnecessary animations. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
1 parent b2d4835 commit 7d3eb9c

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

components/Hero.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { motion } from 'framer-motion';
22
import { Heart } from 'lucide-react';
33
import { ImageWithFallback } from './figma/ImageWithFallback';
4+
import { useIsMobile } from './ui/use-mobile';
45

56
export function Hero() {
7+
const isMobile = useIsMobile();
8+
69
return (
710
<section className="relative flex items-center justify-center min-h-screen px-6">
811
<div className="max-w-6xl mx-auto text-center">
@@ -90,19 +93,21 @@ export function Hero() {
9093
</motion.div>
9194
</motion.div>
9295

93-
<motion.div
94-
animate={{ y: [0, 10, 0] }}
95-
transition={{ duration: 2, repeat: Infinity }}
96-
className="absolute transform -translate-x-1/2 bottom-10 left-1/2"
97-
>
98-
<div className="flex justify-center w-6 h-10 border-2 rounded-full border-amber-600">
99-
<motion.div
100-
animate={{ y: [0, 12, 0] }}
101-
transition={{ duration: 2, repeat: Infinity }}
102-
className="w-1 h-3 mt-2 rounded-full bg-amber-600"
103-
/>
104-
</div>
105-
</motion.div>
96+
{!isMobile && (
97+
<motion.div
98+
animate={{ y: [0, 10, 0] }}
99+
transition={{ duration: 2, repeat: Infinity }}
100+
className="absolute transform -translate-x-1/2 bottom-10 left-1/2"
101+
>
102+
<div className="flex justify-center w-6 h-10 border-2 rounded-full border-amber-600">
103+
<motion.div
104+
animate={{ y: [0, 12, 0] }}
105+
transition={{ duration: 2, repeat: Infinity }}
106+
className="w-1 h-3 mt-2 rounded-full bg-amber-600"
107+
/>
108+
</div>
109+
</motion.div>
110+
)}
106111
</div>
107112
</section>
108113
);

0 commit comments

Comments
 (0)