source: frontend/src/components/navbar.tsx

Last change on this file was b8093a0, checked in by imbrsk <boris696boris@…>, 3 days ago

Merge iknow-remaster into frontend/

Bring the Next.js frontend into this repository as a monorepo subdirectory,
preserving its full commit history via a subtree merge.

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[875f7d6]1"use client"
2import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3import { faUser } from '@fortawesome/free-solid-svg-icons';
4import { faBookmark } from '@fortawesome/free-solid-svg-icons';
5import { faBook } from '@fortawesome/free-solid-svg-icons';
6import { faPenToSquare } from '@fortawesome/free-solid-svg-icons';
7import { faListCheck } from '@fortawesome/free-solid-svg-icons';
8import { faFilePdf } from '@fortawesome/free-solid-svg-icons';
9import { faBars, faTimes, faGraduationCap } from '@fortawesome/free-solid-svg-icons';
10import { useState } from 'react';
[636f86c]11import Link from 'next/link';
[50f2fb4]12import { useTranslation } from 'react-i18next';
[875f7d6]13
14const Navbar = () => {
15 const [isMenuOpen, setIsMenuOpen] = useState(false);
16
17 const toggleMenu = () => {
18 setIsMenuOpen(!isMenuOpen);
19 };
20
[50f2fb4]21 const { t } = useTranslation();
[875f7d6]22 const menuItems = [
[50f2fb4]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' }
[875f7d6]29 ];
30
31 return (
32 <>
33 {/* Desktop Navbar */}
[ba52069]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">
[875f7d6]35 {menuItems.map((item, index) => (
[636f86c]36 <Link key={index} href={item.href}>
[ba52069]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">
[636f86c]38 <FontAwesomeIcon icon={item.icon} className="transition-transform duration-300 group-hover:rotate-12" />
39 <span>{item.label}</span>
40 </div>
41 </Link>
[875f7d6]42 ))}
43 </nav>
44
45 {/* Mobile Navbar */}
[ba52069]46 <nav className="md:hidden bg-primary text-primary-foreground rounded-xl my-5">
[875f7d6]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}
[ba52069]57 className="p-2 rounded-lg hover:bg-card hover:text-card-foreground transition-colors duration-300"
[875f7d6]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) => (
[636f86c]72 <Link key={index} href={item.href}>
[ba52069]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">
[636f86c]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>
[875f7d6]78 ))}
79 </div>
80 </div>
81 </nav>
82 </>
83 );
84};
85
86export default Navbar;
Note: See TracBrowser for help on using the repository browser.