"use client"; import React, { useState, useEffect } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import "./Sidebar.css"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faBars, faCogs, faHome, faStar, faTv, faFilm, faBookBookmark } from "@fortawesome/free-solid-svg-icons"; const Sidebar = () => { const [isOpen, setIsOpen] = useState(false); const pathname = usePathname(); const [hoveredLink, setHoveredLink] = useState(null); const [prevLink, setPrevLink] = useState(null); useEffect(() => { const activeLink = document.querySelector( `.sidebar-link[href="${pathname}"]` ); if (activeLink) { setPrevLink(activeLink); } }, [pathname]); const toggleSidebar = () => { setIsOpen(!isOpen); }; const handleMouseEnter = (e) => { setPrevLink(document.querySelector(".sidebar-link.active")); setHoveredLink(e.target); }; const handleMouseLeave = () => { setHoveredLink(null); }; return (
{isOpen &&

Streamz

}
{isOpen && (
)} {isOpen && (
)}
); }; const SidebarItem = ({ icon, text }) => { return (

{text}

); }; export default Sidebar;