| [8496f3c] | 1 | "use client";
|
|---|
| 2 |
|
|---|
| 3 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|---|
| 4 | import { faBook, faCalendarPlus, faChalkboardUser, faBars, faTimes, faUserGear } 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 AdminNavbar = () => {
|
|---|
| 10 | const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|---|
| 11 | const toggleMenu = () => setIsMenuOpen((v) => !v);
|
|---|
| 12 |
|
|---|
| 13 | const { t } = useTranslation();
|
|---|
| 14 | const menuItems = [
|
|---|
| 15 | { icon: faBook, label: t("admin_subjects"), href: "/admin/subjects" },
|
|---|
| 16 | { icon: faCalendarPlus, label: t("admin_semesters"), href: "/admin/semesters" },
|
|---|
| 17 | { icon: faChalkboardUser, label: t("admin_schedule"), href: "/admin/schedule" },
|
|---|
| 18 | ];
|
|---|
| 19 |
|
|---|
| 20 | return (
|
|---|
| 21 | <>
|
|---|
| 22 | {/* Desktop Navbar */}
|
|---|
| 23 | <nav className="hidden md:flex flex-row gap-2 justify-evenly bg-primary text-primary-foreground 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-card hover:text-card-foreground hover:scale-105 hover:shadow-lg">
|
|---|
| 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-primary-foreground 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={faUserGear} className="text-xl" />
|
|---|
| 39 | {t("admin_portal")}
|
|---|
| 40 | </div>
|
|---|
| 41 | <button
|
|---|
| 42 | onClick={toggleMenu}
|
|---|
| 43 | className="p-2 rounded-lg hover:bg-card hover:text-card-foreground transition-colors duration-300"
|
|---|
| 44 | aria-label="Toggle menu"
|
|---|
| 45 | >
|
|---|
| 46 | <FontAwesomeIcon icon={isMenuOpen ? faTimes : faBars} className="text-xl transition-transform duration-300" />
|
|---|
| 47 | </button>
|
|---|
| 48 | </div>
|
|---|
| 49 |
|
|---|
| 50 | <div className={`overflow-hidden transition-all duration-300 ease-in-out ${isMenuOpen ? "max-h-64 opacity-100" : "max-h-0 opacity-0"}`}>
|
|---|
| 51 | <div className="px-4 pb-4 space-y-2">
|
|---|
| 52 | {menuItems.map((item) => (
|
|---|
| 53 | <Link key={item.href} href={item.href}>
|
|---|
| 54 | <div className="group flex flex-row items-center gap-3 px-3 py-3 rounded-lg cursor-pointer transition-all duration-300 hover:bg-card hover:text-card-foreground">
|
|---|
| 55 | <FontAwesomeIcon icon={item.icon} className="transition-transform duration-300 group-hover:rotate-12" />
|
|---|
| 56 | <span className="text-lg">{item.label}</span>
|
|---|
| 57 | </div>
|
|---|
| 58 | </Link>
|
|---|
| 59 | ))}
|
|---|
| 60 | </div>
|
|---|
| 61 | </div>
|
|---|
| 62 | </nav>
|
|---|
| 63 | </>
|
|---|
| 64 | );
|
|---|
| 65 | };
|
|---|
| 66 |
|
|---|
| 67 | export default AdminNavbar;
|
|---|