import { useState, useEffect, useRef } from "react" import { usePathname } from "next/navigation" import Link from "next/link" import { Button } from "@/components/ui/button" import { ChevronDown, BookOpen, Bookmark, GraduationCap, Check } from "lucide-react" import { SidebarItem } from "../sidebar" const TOPICS = ["Nix", "Javascript", "Kubernetes", "Figma", "Hiring", "Java", "IOS", "Design"] export const TopicSection = () => { const [showOptions, setShowOptions] = useState(false) const [selectedStatus, setSelectedStatus] = useState(null) const sectionRef = useRef(null) const learningOptions = [ { text: "To Learn", icon: , color: "text-white/70" }, { text: "Learning", icon: , color: "text-[#D29752]" }, { text: "Learned", icon: , color: "text-[#708F51]" } ] const statusSelect = (status: string) => { setSelectedStatus(status === "Show All" ? null : status) setShowOptions(false) } useEffect(() => { const overlayClick = (event: MouseEvent) => { if (sectionRef.current && !sectionRef.current.contains(event.target as Node)) { setShowOptions(false) } } document.addEventListener("mousedown", overlayClick) return () => { document.removeEventListener("mousedown", overlayClick) } }, []) const availableOptions = selectedStatus ? [ { text: "Show All", icon: , color: "text-white" }, ...learningOptions.filter(option => option.text !== selectedStatus) ] : learningOptions // const topicClick = (topic: string) => { // router.push(`/${topic.toLowerCase()}`) // } return (
{showOptions && (
{availableOptions.map(option => ( ))}
)}
{TOPICS.map(topic => ( ))}
) } export default TopicSection