2025-09-21 21:06:02 +01:00

80 lines
2.8 KiB
TypeScript

import { LogOut, User } from "lucide-react";
interface HeaderProps {
user?: { email: string; name: string } | null;
onLogout?: () => void;
}
export function Header({ user, onLogout }: HeaderProps) {
return (
<header className="bg-white shadow-sm border-b">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between items-center h-16">
<div className="flex items-center">
{/* <Package className="h-8 w-8 text-primary-600" /> */}
<span className="ml-2 text-xl font-bold text-gray-900">
SubscriptionHub
</span>
</div>
<nav className="hidden md:flex space-x-8">
<a
href="/"
className="text-gray-500 hover:text-gray-900 px-3 py-2 text-sm font-medium"
>
Home
</a>
<a
href="/packages"
className="text-gray-500 hover:text-gray-900 px-3 py-2 text-sm font-medium"
>
Packages
</a>
{user && (
<a
href="/dashboard"
className="text-gray-500 hover:text-gray-900 px-3 py-2 text-sm font-medium"
>
Dashboard
</a>
)}
</nav>
<div className="flex items-center space-x-4">
{user ? (
<div className="flex items-center space-x-3">
<div className="flex items-center space-x-2">
<User className="h-5 w-5 text-gray-400" />
<span className="text-sm text-gray-700">{user.email}</span>
{user.name && (
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary-100 text-primary-800">
{user.name}
</span>
)}
</div>
<a
href="/api/auth/signout"
className="flex items-center space-x-1 text-gray-500 hover:text-gray-700"
>
<LogOut className="h-4 w-4" />
<span className="text-sm">Logout</span>
</a>
{/* <button
onClick={onLogout}
className="flex items-center space-x-1 text-gray-500 hover:text-gray-700"
>
<LogOut className="h-4 w-4" />
<span className="text-sm">Logout</span>
</button> */}
</div>
) : (
<button className="bg-primary-600 text-white px-4 py-2 rounded-md text-sm font-medium hover:bg-primary-700">
Sign In
</button>
)}
</div>
</div>
</div>
</header>
);
}