| 1 | "use client"
|
|---|
| 2 | import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|---|
| 3 | import { faUser } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 4 | import { faBookmark } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 5 | import { faBook } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 6 | import { faPenToSquare } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 7 | import { faListCheck } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 8 | import { faFilePdf } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 9 | import { faBars, faTimes, faGraduationCap } from '@fortawesome/free-solid-svg-icons';
|
|---|
| 10 | import { useState } from 'react';
|
|---|
| 11 | import Link from 'next/link';
|
|---|
| 12 | import { useTranslation } from 'react-i18next';
|
|---|
| 13 |
|
|---|
| 14 | const Navbar = () => {
|
|---|
| 15 | const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|---|
| 16 |
|
|---|
| 17 | const toggleMenu = () => {
|
|---|
| 18 | setIsMenuOpen(!isMenuOpen);
|
|---|
| 19 | };
|
|---|
| 20 |
|
|---|
| 21 | const { t } = useTranslation();
|
|---|
| 22 | const menuItems = [
|
|---|
| 23 | { icon: faUser, label: t('profile'), href: '/students/profile' },
|
|---|
| 24 | { icon: faBookmark, label: t('semesters'), href: '/students/semesters' },
|
|---|
| 25 | { icon: faBook, label: t('subjects'), href: '/students/subjects' },
|
|---|
| 26 | { icon: faPenToSquare, label: t('applications'), href: '/students/applications' },
|
|---|
| 27 | { icon: faListCheck, label: t('exams'), href: '/students/exams' },
|
|---|
| 28 | { icon: faFilePdf, label: t('documents'), href: '/students/documents' }
|
|---|
| 29 | ];
|
|---|
| 30 |
|
|---|
| 31 | return (
|
|---|
| 32 | <>
|
|---|
| 33 | {/* Desktop Navbar */}
|
|---|
| 34 | <nav className="hidden md:flex flex-row gap-2 justify-evenly bg-primary text-primary-foreground p-7 rounded-xl my-5 text-xl">
|
|---|
| 35 | {menuItems.map((item, index) => (
|
|---|
| 36 | <Link key={index} href={item.href}>
|
|---|
| 37 | <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">
|
|---|
| 38 | <FontAwesomeIcon icon={item.icon} className="transition-transform duration-300 group-hover:rotate-12" />
|
|---|
| 39 | <span>{item.label}</span>
|
|---|
| 40 | </div>
|
|---|
| 41 | </Link>
|
|---|
| 42 | ))}
|
|---|
| 43 | </nav>
|
|---|
| 44 |
|
|---|
| 45 | {/* Mobile Navbar */}
|
|---|
| 46 | <nav className="md:hidden bg-primary text-primary-foreground rounded-xl my-5">
|
|---|
| 47 | <div className="flex justify-between items-center p-4">
|
|---|
| 48 | {/* IKnow Logo/Text */}
|
|---|
| 49 | <div className="flex items-center gap-2 text-xl font-bold">
|
|---|
| 50 | <FontAwesomeIcon icon={faGraduationCap} className="text-xl" />
|
|---|
| 51 | IKnow
|
|---|
| 52 | </div>
|
|---|
| 53 |
|
|---|
| 54 | {/* Hamburger Menu Button */}
|
|---|
| 55 | <button
|
|---|
| 56 | onClick={toggleMenu}
|
|---|
| 57 | className="p-2 rounded-lg hover:bg-card hover:text-card-foreground transition-colors duration-300"
|
|---|
| 58 | >
|
|---|
| 59 | <FontAwesomeIcon
|
|---|
| 60 | icon={isMenuOpen ? faTimes : faBars}
|
|---|
| 61 | className="text-xl transition-transform duration-300"
|
|---|
| 62 | />
|
|---|
| 63 | </button>
|
|---|
| 64 | </div>
|
|---|
| 65 |
|
|---|
| 66 | {/* Mobile Menu Items */}
|
|---|
| 67 | <div className={`overflow-hidden transition-all duration-300 ease-in-out ${
|
|---|
| 68 | isMenuOpen ? 'max-h-96 opacity-100' : 'max-h-0 opacity-0'
|
|---|
| 69 | }`}>
|
|---|
| 70 | <div className="px-4 pb-4 space-y-2">
|
|---|
| 71 | {menuItems.map((item, index) => (
|
|---|
| 72 | <Link key={index} href={item.href}>
|
|---|
| 73 | <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">
|
|---|
| 74 | <FontAwesomeIcon icon={item.icon} className="transition-transform duration-300 group-hover:rotate-12" />
|
|---|
| 75 | <span className="text-lg">{item.label}</span>
|
|---|
| 76 | </div>
|
|---|
| 77 | </Link>
|
|---|
| 78 | ))}
|
|---|
| 79 | </div>
|
|---|
| 80 | </div>
|
|---|
| 81 | </nav>
|
|---|
| 82 | </>
|
|---|
| 83 | );
|
|---|
| 84 | };
|
|---|
| 85 |
|
|---|
| 86 | export default Navbar;
|
|---|