diff --git a/src/app/components/TopicsList.tsx b/src/app/components/TopicsList.tsx index 9c4971a..14332e1 100644 --- a/src/app/components/TopicsList.tsx +++ b/src/app/components/TopicsList.tsx @@ -2,39 +2,10 @@ import Link from 'next/link'; import { topics } from '../constants/topics'; -import { useState, useEffect, useRef } from 'react'; +import { useState } from 'react'; export default function TopicsList() { const [hoveredTopic, setHoveredTopic] = useState(null); - const tooltipRefs = useRef<{ [key: string]: HTMLDivElement | null }>({}); - const buttonRefs = useRef<{ [key: string]: HTMLButtonElement | null }>({}); - - const setTooltipRef = (id: string) => (el: HTMLDivElement | null) => { - tooltipRefs.current[id] = el; - }; - - const setButtonRef = (id: string) => (el: HTMLButtonElement | null) => { - buttonRefs.current[id] = el; - }; - - useEffect(() => { - const handleClickOutside = (event: MouseEvent) => { - if (hoveredTopic) { - const tooltip = tooltipRefs.current[hoveredTopic]; - const button = buttonRefs.current[hoveredTopic]; - if (tooltip && button && - !tooltip.contains(event.target as Node) && - !button.contains(event.target as Node)) { - setHoveredTopic(null); - } - } - }; - - document.addEventListener('mousedown', handleClickOutside); - return () => { - document.removeEventListener('mousedown', handleClickOutside); - }; - }, [hoveredTopic]); return (
@@ -48,22 +19,17 @@ export default function TopicsList() {

{topic.title}

- +