mastodon/app/javascript/flavours/glitch/components/gif.tsx
Claire 079fa6bade [Glitch] Move app/javascript/hooks to app/javascript/flavours/glitch/hooks
Port b57687083f to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2025-03-07 17:45:57 +01:00

22 lines
609 B
TypeScript

import { useHovering } from 'flavours/glitch/hooks/useHovering';
import { autoPlayGif } from 'flavours/glitch/initial_state';
export const GIF: React.FC<{
src: string;
staticSrc: string;
className: string;
animate?: boolean;
}> = ({ src, staticSrc, className, animate = autoPlayGif }) => {
const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(animate);
return (
<img
className={className}
src={hovering || animate ? src : staticSrc}
alt=''
role='presentation'
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
/>
);
};