-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathHeader.jsx
More file actions
56 lines (52 loc) · 1.61 KB
/
Copy pathHeader.jsx
File metadata and controls
56 lines (52 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Application header with navigation
*/
import React from 'react';
import { Link } from 'react-router-dom';
import Button from './Button';
function Header({ user, onLogout }) {
return (
<header className="bg-white shadow-sm border-b">
<div className="max-w-7xl mx-auto px-4 py-4 flex items-center justify-between">
<div className="flex items-center gap-8">
<Link to="/" className="text-xl font-bold text-gray-900">
MyApp
</Link>
<nav className="hidden md:flex gap-6">
<Link to="/products" className="text-gray-600 hover:text-gray-900">
Products
</Link>
<Link to="/about" className="text-gray-600 hover:text-gray-900">
About
</Link>
{user && (
<Link to="/dashboard" className="text-gray-600 hover:text-gray-900">
Dashboard
</Link>
)}
</nav>
</div>
<div className="flex items-center gap-4">
{user ? (
<>
<span className="text-gray-700">Hello, {user.name}</span>
<Button variant="secondary" size="small" onClick={onLogout}>
Logout
</Button>
</>
) : (
<>
<Link to="/login">
<Button variant="secondary" size="small">Login</Button>
</Link>
<Link to="/register">
<Button size="small">Sign Up</Button>
</Link>
</>
)}
</div>
</div>
</header>
);
}
export default Header;