import { BookOpenText, CheckSquare, FileQuestion, FolderKanban, Menu, Shirt, Video, Map, } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; import { cn } from '../lib/classname.ts'; import { useOutsideClick } from '../hooks/use-outside-click.ts'; import { navigationDropdownOpen, roadmapsDropdownOpen, } from '../stores/page.ts'; import { useStore } from '@nanostores/react'; const links = [ { link: '/roadmaps', label: 'Official Roadmaps', description: 'Made by subject matter experts', Icon: Map, isHighlighted: true, }, { link: '/projects', label: 'Projects', description: 'Skill-up with real-world projects', Icon: FolderKanban, isHighlighted: false, }, { link: '/best-practices', label: 'Best Practices', description: "Do's and don'ts", Icon: CheckSquare, isHighlighted: false, }, { link: '/questions', label: 'Questions', description: 'Test and Practice your knowledge', Icon: FileQuestion, isHighlighted: false, }, { link: '/guides', label: 'Guides', description: 'In-depth articles and tutorials', Icon: BookOpenText, isHighlighted: false, }, { link: 'https://youtube.com/@roadmapsh', label: 'Videos', description: 'Animated and interactive content', Icon: Video, isExternal: true, isHighlighted: false, }, { link: 'https://cottonbureau.com/people/roadmapsh', label: 'Shop', description: 'Get some cool swag', Icon: Shirt, isExternal: true, isHighlighted: false, }, { link: '/advertise', label: 'Advertise', description: 'Promote your product or service', Icon: Menu, isHighlighted: false, }, ]; export function NavigationDropdown() { const dropdownRef = useRef(null); const $navigationDropdownOpen = useStore(navigationDropdownOpen); const $roadmapsDropdownOpen = useStore(roadmapsDropdownOpen); useOutsideClick(dropdownRef, () => { navigationDropdownOpen.set(false); }); useEffect(() => { if ($roadmapsDropdownOpen) { navigationDropdownOpen.set(false); } }, [$roadmapsDropdownOpen]); return (
{links.map((link) => ( {link.label} {link.description} ))}
); }