"use client"; import { useEffect, useRef, useState } from "react"; import { Badge, Typography } from "poyraz-ui/atoms"; import { ImageCard, Popover, PopoverContent, PopoverTrigger, } from "poyraz-ui/molecules"; type ProjectCardWithPopoverProps = { title: string; description: string; image: string; badge?: string; href?: string; technologies: string[]; architecture: string; technologiesLabel: string; architectureLabel: string; className?: string; triggerClassName?: string; }; export function ProjectCardWithPopover({ title, description, image, badge, href, technologies, architecture, technologiesLabel, architectureLabel, className, triggerClassName, }: ProjectCardWithPopoverProps) { const [open, setOpen] = useState(false); const closeTimer = useRef | null>(null); const cancelClose = () => { if (closeTimer.current) { clearTimeout(closeTimer.current); closeTimer.current = null; } }; const showPopover = () => { cancelClose(); setOpen(true); }; const scheduleClose = () => { cancelClose(); closeTimer.current = setTimeout(() => setOpen(false), 120); }; useEffect(() => { return () => { if (closeTimer.current) clearTimeout(closeTimer.current); }; }, []); const card = ( ); const triggerClasses = `block ${triggerClassName ?? ""} text-inherit outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`; return ( {href ? ( {card} ) : ( )} event.preventDefault()} onCloseAutoFocus={(event) => event.preventDefault()} >
{title}
{technologiesLabel}
{technologies.map((technology) => ( {technology} ))}
{architectureLabel} {architecture}
); }