import { useHotkeys, usePageLeave, useTimeout } from '@mantine/hooks';
import { useContextMenu } from 'mantine-contextmenu';
import { useEffect } from 'react';
import Picture from '~/components/Picture';
import { copyImageToClipboard, downloadImage, unsplashImages } from '~/lib/image';
export default function ImperativeHidingExample() {
const { showContextMenu, hideContextMenu, isContextMenuVisible } = useContextMenu();
const { start: startHiding, clear: cancelHiding } = useTimeout(hideContextMenu, 5000);
if (isContextMenuVisible) {
}, [cancelHiding, isContextMenuVisible, startHiding]);
useHotkeys([['H', hideContextMenu]]);
usePageLeave(hideContextMenu);
onContextMenu={showContextMenu([
onClick: () => copyImageToClipboard(src),
onClick: () => downloadImage(src),