Skip to content

Commit

Permalink
Remove State for Preview Image
Browse files Browse the repository at this point in the history
  • Loading branch information
dquilter committed Feb 25, 2025
1 parent 65a485d commit 5793de3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/_components/_sharedcomponents/Cards/GameCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ const GameCard: React.FC<IGameCardProps> = ({
const handlePreviewOpen = (event: React.MouseEvent<HTMLElement>) => {
const target = event.currentTarget;
const imageUrl = target.getAttribute('data-card-url');

if (!imageUrl) return;

if (cardInOpponentsHand) {
return;
}

hoverTimeout.current = window.setTimeout(() => {
setAnchorElement(target);
setPreviewImage(`url(${imageUrl})`);
Expand All @@ -47,6 +49,7 @@ const GameCard: React.FC<IGameCardProps> = ({
const handlePreviewClose = () => {
clearTimeout(hoverTimeout.current);
setAnchorElement(null);
setPreviewImage(null);
};

const popoverConfig = (): { anchorOrigin: PopoverOrigin, transformOrigin: PopoverOrigin } => {
Expand Down

0 comments on commit 5793de3

Please sign in to comment.