mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-03 21:43:40 -05:00
64fc79cbc2
Port 7f2cfcccab8d81feca98328e371373a9dd7f7c12 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
23 lines
595 B
TypeScript
23 lines
595 B
TypeScript
import { useHovering } from '@/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}
|
|
/>
|
|
);
|
|
};
|