| 1 | "use client";
|
|---|
| 2 |
|
|---|
| 3 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|---|
| 4 | import { faUser, faUsers, faBars, faTimes, faChalkboardUser } from "@fortawesome/free-solid-svg-icons";
|
|---|
| 5 | import Link from "next/link";
|
|---|
| 6 | import { useState } from "react";
|
|---|
| 7 |
|
|---|
| 8 | const ProfessorNavbar = () => {
|
|---|
| 9 | const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|---|
| 10 |
|
|---|
| 11 | const toggleMenu = () => {
|
|---|
| 12 | setIsMenuOpen((v) => !v);
|
|---|
| 13 | };
|
|---|
| 14 |
|
|---|
| 15 | const menuItems = [
|
|---|
| 16 | { icon: faUser, label: "Профил", href: "/professor/profile" },
|
|---|
| 17 | { icon: faUsers, label: "Студенти", href: "/professor/students" },
|
|---|
| 18 | ];
|
|---|
| 19 |
|
|---|
| 20 | return (
|
|---|
| 21 | <>
|
|---|
| 22 | {/* Desktop Navbar */}
|
|---|
| 23 | <nav className="hidden md:flex flex-row gap-2 justify-evenly bg-primary text-white p-7 rounded-xl my-5 text-xl">
|
|---|
| 24 | {menuItems.map((item) => (
|
|---|
| 25 | <Link key={item.href} href={item.href}>
|
|---|
| 26 | <div className="group flex flex-row items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-all duration-300 hover:bg-white hover:bg-opacity-20 hover:scale-105 hover:shadow-lg hover:text-primary">
|
|---|
| 27 | <FontAwesomeIcon icon={item.icon} className="transition-transform duration-300 group-hover:rotate-12" />
|
|---|
| 28 | <span>{item.label}</span>
|
|---|
| 29 | </div>
|
|---|
| 30 | </Link>
|
|---|
| 31 | ))}
|
|---|
| 32 | </nav>
|
|---|
| 33 |
|
|---|
| 34 | {/* Mobile Navbar */}
|
|---|
| 35 | <nav className="md:hidden bg-primary text-white rounded-xl my-5">
|
|---|
| 36 | <div className="flex justify-between items-center p-4">
|
|---|
| 37 | <div className="flex items-center gap-2 text-xl font-bold">
|
|---|
| 38 | <FontAwesomeIcon icon={faChalkboardUser} className="text-xl" />
|
|---|
| 39 | Professor
|
|---|
| 40 | </div>
|
|---|
| 41 |
|
|---|
| 42 | <button
|
|---|
| 43 | onClick={toggleMenu}
|
|---|
| 44 | className="p-2 rounded-lg hover:bg-white hover:bg-opacity-20 transition-colors duration-300"
|
|---|
| 45 | aria-label="Toggle menu"
|
|---|
| 46 | >
|
|---|
| 47 | <FontAwesomeIcon
|
|---|
| 48 | icon={isMenuOpen ? faTimes : faBars}
|
|---|
| 49 | className="text-xl transition-transform duration-300"
|
|---|
| 50 | />
|
|---|
| 51 | </button>
|
|---|
| 52 | </div>
|
|---|
| 53 |
|
|---|
| 54 | <div
|
|---|
| 55 | className={`overflow-hidden transition-all duration-300 ease-in-out ${
|
|---|
| 56 | isMenuOpen ? "max-h-64 opacity-100" : "max-h-0 opacity-0"
|
|---|
| 57 | }`}
|
|---|
| 58 | >
|
|---|
| 59 | <div className="px-4 pb-4 space-y-2">
|
|---|
| 60 | {menuItems.map((item) => (
|
|---|
| 61 | <Link key={item.href} href={item.href}>
|
|---|
| 62 | <div className="group flex flex-row items-center gap-3 px-3 py-3 rounded-lg cursor-pointer transition-all duration-300 hover:bg-white hover:bg-opacity-20 hover:text-primary">
|
|---|
| 63 | <FontAwesomeIcon
|
|---|
| 64 | icon={item.icon}
|
|---|
| 65 | className="transition-transform duration-300 group-hover:rotate-12"
|
|---|
| 66 | />
|
|---|
| 67 | <span className="text-lg">{item.label}</span>
|
|---|
| 68 | </div>
|
|---|
| 69 | </Link>
|
|---|
| 70 | ))}
|
|---|
| 71 | </div>
|
|---|
| 72 | </div>
|
|---|
| 73 | </nav>
|
|---|
| 74 | </>
|
|---|
| 75 | );
|
|---|
| 76 | };
|
|---|
| 77 |
|
|---|
| 78 | export default ProfessorNavbar;
|
|---|