diff --git a/components/RepositoryItem.tsx b/components/RepositoryItem.tsx index e01c709..6b41bb9 100644 --- a/components/RepositoryItem.tsx +++ b/components/RepositoryItem.tsx @@ -14,6 +14,7 @@ type RepositoryItemProps = { export const RepositoryItem = ({ repository }: RepositoryItemProps) => { const [isIssueOpen, setIsIssueOpen] = useState(false); + const [isIssuesListVisible, setIsIssuesListVisible] = useState(false); dayjs.extend(relativeTime); const useLastModified = (date: string) => { @@ -25,10 +26,20 @@ export const RepositoryItem = ({ repository }: RepositoryItemProps) => { }; const lastModified = useLastModified(repository.last_modified); + useEffect(() => { + if (isIssueOpen) { + setIsIssuesListVisible(true); + } else { + // Delay unmounting to allow close animation to complete + const timer = setTimeout(() => setIsIssuesListVisible(false), 300); + return () => clearTimeout(timer); + } + }, [isIssueOpen]); + return (