Skip to content

Commit 2bdf232

Browse files
committed
update dashboard header file
1 parent 37eaa80 commit 2bdf232

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed
Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
1-
import React from "react";
1+
import React from 'react';
2+
3+
// HIGHLIGHT: handleLogout prop ko yahan receive karein
4+
const Header = ({ handleLogout }) => {
5+
// localStorage se username nikalein
6+
const username = localStorage.getItem("username");
27

3-
function Header() {
48
return (
5-
<>
6-
<header className="flex justify-between items-center mb-6">
7-
<a href="dashboard" className="text-3xl text-green-700 font-bold">
8-
Dashboard
9-
</a>
10-
</header>
11-
</>
9+
<header className="flex flex-col sm:flex-row justify-between items-start sm:items-center mb-6 gap-4">
10+
11+
{/* Welcome Message Section */}
12+
<div>
13+
{/* HIGHLIGHT: User ka naam aur welcome message */}
14+
<h1 className="text-3xl font-bold text-gray-800">Welcome, {username || 'User'}!</h1>
15+
<p className="text-gray-500">Here's what's new and trending today.</p>
16+
</div>
17+
18+
{/* Logout Button Section */}
19+
<div>
20+
{/* HIGHLIGHT: Logout button jo Dashboard se pass kiye gaye function ko call karta hai */}
21+
<button
22+
onClick={handleLogout}
23+
className="bg-red-500 text-white px-5 py-2 rounded-lg font-semibold hover:bg-red-600 transition shadow-md"
24+
>
25+
Logout
26+
</button>
27+
</div>
28+
29+
</header>
1230
);
13-
}
31+
};
1432

1533
export default Header;
34+

src/User/pages/Dashboard/Dashboard.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ const Dashboard = () => {
171171
<main className="flex-1 p-6 mt-10">
172172
{/* Header */}
173173
<Header handleLogout={handleLogout} />{" "}
174+
174175
{/* Pass handleLogout to Header */}
176+
175177
{/* Search Bar */}
176178
<SearchBar searchTerm={searchTerm} handleSearch={handleSearch} />
177179
{/* New Today Section */}

0 commit comments

Comments
 (0)