cryogenic22 commited on
Commit
6c2251a
·
verified ·
1 Parent(s): ef5a9bc

Create frontend/src/components/shared/Navigation.tsx

Browse files
frontend/src/components/shared/Navigation.tsx ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // src/components/shared/Navigation.tsx
2
+ import React from 'react';
3
+ import { Home, BookOpen, Code, MessageCircle, User, LogOut } from 'lucide-react';
4
+ import { useUser } from '../../contexts/UserContext';
5
+
6
+ const NavLink = ({ href, icon, children }) => (
7
+ <a
8
+ href={href}
9
+ className="inline-flex items-center gap-2 px-1 pt-1 text-gray-600 hover:text-gray-900
10
+ border-b-2 border-transparent hover:border-blue-500"
11
+ >
12
+ {icon}
13
+ <span>{children}</span>
14
+ </a>
15
+ );
16
+
17
+ const Navigation = () => {
18
+ const { user, logout } = useUser();
19
+
20
+ return (
21
+ <nav className="bg-white shadow-sm">
22
+ <div className="max-w-7xl mx-auto px-4">
23
+ <div className="flex justify-between h-16">
24
+ {/* Logo and main nav */}
25
+ <div className="flex">
26
+ <div className="flex-shrink-0 flex items-center">
27
+ <span className="text-2xl font-bold text-blue-600">EduAI</span>
28
+ </div>
29
+
30
+ <div className="hidden sm:ml-6 sm:flex sm:space-x-8">
31
+ <NavLink icon={<Home size={20} />} href="/">Home</NavLink>
32
+ <NavLink icon={<BookOpen size={20} />} href="/paths">Learning Paths</NavLink>
33
+ <NavLink icon={<MessageCircle size={20} />} href="/tutor">AI Tutor</NavLink>
34
+ <NavLink icon={<Code size={20} />} href="/playground">Code Playground</NavLink>
35
+ </div>
36
+ </div>
37
+
38
+ {/* User menu */}
39
+ <div className="flex items-center">
40
+ {user.isAuthenticated ? (
41
+ <div className="flex items-center gap-4">
42
+ <span className="text-gray-700">{user.username}</span>
43
+ <button
44
+ onClick={logout}
45
+ className="flex items-center gap-2 text-gray-600 hover:text-gray-900"
46
+ >
47
+ <LogOut size={20} />
48
+ <span className="hidden sm:inline">Sign out</span>
49
+ </button>
50
+ </div>
51
+ ) : (
52
+ <button className="flex items-center gap-2 text-blue-600 hover:text-blue-800">
53
+ <User size={20} />
54
+ <span>Sign in</span>
55
+ </button>
56
+ )}
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </nav>
61
+ );
62
+ };
63
+
64
+ export default Navigation;