Skip to content

Commit d59a39c

Browse files
committed
docs(landing): sync right-side preview on hover in LandingSweetSpot
1 parent 028269d commit d59a39c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

documentation/src/refine-theme/landing-sweet-spot.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ export const LandingSweetSpot: FC<Props> = ({ className }) => {
2929
const activeListItem = list[activeIndex];
3030

3131
const [shouldIncrement, setShouldIncrement] = useState(true);
32+
const [isHovering, setIsHovering] = useState(false);
3233

3334
useEffect(() => {
34-
if (!shouldIncrement) {
35+
if (!shouldIncrement || isHovering) {
3536
return;
3637
}
3738

@@ -43,7 +44,7 @@ export const LandingSweetSpot: FC<Props> = ({ className }) => {
4344
}
4445

4546
return () => clearInterval(interval);
46-
}, [shouldIncrement, inView]);
47+
}, [shouldIncrement, inView, isHovering]);
4748

4849
return (
4950
<div ref={ref} className={clsx(className, "w-full")}>
@@ -180,6 +181,13 @@ export const LandingSweetSpot: FC<Props> = ({ className }) => {
180181
setShouldIncrement(false);
181182
setActiveIndex(index);
182183
}}
184+
onMouseEnter={() => {
185+
setIsHovering(true);
186+
setActiveIndex(index);
187+
}}
188+
onMouseLeave={() => {
189+
setIsHovering(false);
190+
}}
183191
className={clsx(
184192
"appearance-none",
185193
"focus:outline-none",

0 commit comments

Comments
 (0)