Skip to content

Commit 48782d2

Browse files
chore: fix state lag on hover
1 parent 782e9f6 commit 48782d2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

apps/sim/app/(landing)/components/hero/components/icon-button.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface IconButtonProps {
99
style?: React.CSSProperties
1010
'aria-label': string
1111
isAutoHovered?: boolean
12+
highlightFromParent?: boolean
1213
}
1314

1415
export function IconButton({
@@ -18,17 +19,23 @@ export function IconButton({
1819
style,
1920
'aria-label': ariaLabel,
2021
isAutoHovered = false,
22+
highlightFromParent = false,
2123
}: IconButtonProps) {
24+
const showOwnHighlight = !highlightFromParent && isAutoHovered
25+
const hoverHighlight = !highlightFromParent
26+
? 'hover:border-[#E5E5E5] hover:shadow-[0_2px_4px_0_rgba(0,0,0,0.08)]'
27+
: ''
28+
2229
return (
2330
<button
2431
type='button'
2532
aria-label={ariaLabel}
2633
onClick={onClick}
2734
onMouseEnter={onMouseEnter}
2835
className={`flex items-center justify-center rounded-xl border p-2 outline-none transition-all duration-300 ${
29-
isAutoHovered
36+
showOwnHighlight
3037
? 'border-[#E5E5E5] shadow-[0_2px_4px_0_rgba(0,0,0,0.08)]'
31-
: 'border-transparent hover:border-[#E5E5E5] hover:shadow-[0_2px_4px_0_rgba(0,0,0,0.08)]'
38+
: `border-transparent ${hoverHighlight}`
3239
}`}
3340
style={style}
3441
>

apps/sim/app/(landing)/components/hero/hero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ export default function Hero() {
448448
onClick={() => handleServiceClick(service.key as keyof typeof SERVICE_TEMPLATES)}
449449
onMouseEnter={() => setLastHoveredIndex(index)}
450450
style={service.style}
451-
isAutoHovered={!isUserHovering && index === autoHoverIndex}
451+
highlightFromParent
452452
>
453453
<Icon className='h-5 w-5 sm:h-6 sm:w-6' />
454454
</IconButton>

0 commit comments

Comments
 (0)