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