diff --git a/apps/sim/app/(landing)/components/hero/components/icon-button.tsx b/apps/sim/app/(landing)/components/hero/components/icon-button.tsx
index c8e523e2f86..fd6a0901839 100644
--- a/apps/sim/app/(landing)/components/hero/components/icon-button.tsx
+++ b/apps/sim/app/(landing)/components/hero/components/icon-button.tsx
@@ -1,6 +1,7 @@
'use client'
import type React from 'react'
+import { motion } from 'framer-motion'
interface IconButtonProps {
children: React.ReactNode
@@ -8,7 +9,7 @@ interface IconButtonProps {
onMouseEnter?: () => void
style?: React.CSSProperties
'aria-label': string
- isAutoHovered?: boolean
+ isActive?: boolean
}
export function IconButton({
@@ -17,7 +18,7 @@ export function IconButton({
onMouseEnter,
style,
'aria-label': ariaLabel,
- isAutoHovered = false,
+ isActive = false,
}: IconButtonProps) {
return (
)
}
diff --git a/apps/sim/app/(landing)/components/hero/hero.tsx b/apps/sim/app/(landing)/components/hero/hero.tsx
index 546dc47627f..7817c082886 100644
--- a/apps/sim/app/(landing)/components/hero/hero.tsx
+++ b/apps/sim/app/(landing)/components/hero/hero.tsx
@@ -149,7 +149,7 @@ export default function Hero() {
*/
const [autoHoverIndex, setAutoHoverIndex] = React.useState(1)
const [isUserHovering, setIsUserHovering] = React.useState(false)
- const [lastHoveredIndex, setLastHoveredIndex] = React.useState(null)
+ const [hoveredIndex, setHoveredIndex] = React.useState(null)
const intervalRef = React.useRef(null)
/**
@@ -225,6 +225,12 @@ export default function Hero() {
}
}, [isUserHovering, visibleIconCount])
+ /**
+ * The active icon index used to position the shared highlight pill.
+ * When the user is hovering, use their hovered icon; otherwise use auto-hover.
+ */
+ const activeIconIndex = isUserHovering && hoveredIndex !== null ? hoveredIndex : autoHoverIndex
+
/**
* Handle mouse enter on icon container
*/
@@ -239,10 +245,12 @@ export default function Hero() {
* Handle mouse leave on icon container
*/
const handleIconContainerMouseLeave = () => {
+ const lastIndex = hoveredIndex
setIsUserHovering(false)
+ setHoveredIndex(null)
// Start from the next icon after the last hovered one
- if (lastHoveredIndex !== null) {
- setAutoHoverIndex((lastHoveredIndex + 1) % visibleIconCount)
+ if (lastIndex !== null) {
+ setAutoHoverIndex((lastIndex + 1) % visibleIconCount)
}
}
@@ -389,9 +397,9 @@ export default function Hero() {
key={service.key}
aria-label={service.label}
onClick={() => handleServiceClick(service.key as keyof typeof SERVICE_TEMPLATES)}
- onMouseEnter={() => setLastHoveredIndex(index)}
+ onMouseEnter={() => setHoveredIndex(index)}
style={service.style}
- isAutoHovered={!isUserHovering && index === autoHoverIndex}
+ isActive={index === activeIconIndex}
>