0
0
Fork 0

Move app/javascript/hooks to app/javascript/mastodon/hooks (#34077)

This commit is contained in:
Claire 2025-03-05 17:55:53 +01:00 committed by GitHub
parent 00dbefdbbf
commit b57687083f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 15 additions and 17 deletions

View file

@ -0,0 +1,17 @@
import { useCallback, useState } from 'react';
export const useHovering = (animate?: boolean) => {
const [hovering, setHovering] = useState<boolean>(animate ?? false);
const handleMouseEnter = useCallback(() => {
if (animate) return;
setHovering(true);
}, [animate]);
const handleMouseLeave = useCallback(() => {
if (animate) return;
setHovering(false);
}, [animate]);
return { hovering, handleMouseEnter, handleMouseLeave };
};