import React, { useState, useEffect } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { motion, AnimatePresence } from 'framer-motion'; import { Sun, Moon, Menu, X } from 'lucide-react'; function Navbar() { const [isOpen, setIsOpen] = useState(false); const [theme, setTheme] = useState(() => { // Check for saved theme in localStorage or default to quantumlight return localStorage.getItem('theme') || 'quantumlight'; }); const location = useLocation(); useEffect(() => { const html = document.documentElement; const head = document.querySelector('head'); // Set data-theme on both html and head for compatibility html.setAttribute('data-theme', theme); head.setAttribute('data-theme', theme); // Handle Tailwind dark mode if (theme === 'quantumdark') { html.classList.add('dark'); } else { html.classList.remove('dark'); } // Save theme to localStorage localStorage.setItem('theme', theme); }, [theme]); const toggleNavbar = () => setIsOpen(!isOpen); return (
GXS QuantumNexus {/* Desktop Menu */}
{[ { path: '/', label: 'Home', icon: 'fas fa-home' }, //{ path: '/circuit-designer', label: 'Circuit Designer', icon: 'fas fa-project-diagram' }, { path: '/glossary', label: 'Glossary', icon: 'fas fa-book' }, ].map((item) => ( {item.label} ))} Facebook
{/* Theme Toggle */} setTheme(theme === 'quantumlight' ? 'quantumdark' : 'quantumlight')} className="p-2 rounded-lg hover:bg-base-200 transition-all" > {theme === 'quantumlight' ? ( ) : ( )} {/* Mobile Menu Toggle */} {isOpen ? ( ) : ( )}
{/* Mobile Menu */} {isOpen && (
{[ { path: '/', label: 'Home', icon: 'fas fa-home' }, //{ path: '/circuit-designer', label: 'Circuit Designer', icon: 'fas fa-project-diagram' }, { path: '/glossary', label: 'Glossary', icon: 'fas fa-book' }, ].map((item, index) => ( setIsOpen(false)} className={`block px-4 py-3 rounded-lg transition-all flex items-center gap-3 ${ location.pathname === item.path ? 'bg-primary text-primary-content' : 'hover:bg-base-200' }`} > {item.label} ))} setIsOpen(false)} className="block px-4 py-3 rounded-lg hover:bg-base-200 transition-all flex items-center gap-3" > Facebook
)}
); } export default Navbar;