29 lines
780 B
TypeScript
29 lines
780 B
TypeScript
"use client";
|
|
import Link from "next/link";
|
|
import { useAuthStore } from "@/store/authStore";
|
|
|
|
export default function Navbar() {
|
|
const { user, logout } = useAuthStore();
|
|
|
|
return (
|
|
<nav className="bg-gray-800 text-white p-4 flex justify-between items-center">
|
|
<div className="font-bold text-xl">Website Builder</div>
|
|
<div className="space-x-4">
|
|
<Link href="/">Home</Link>
|
|
{user ? (
|
|
<>
|
|
<span>{user.email}</span>
|
|
<button onClick={logout} className="bg-red-600 px-2 py-1 rounded">
|
|
Logout
|
|
</button>
|
|
</>
|
|
) : (
|
|
<>
|
|
<Link href="/login">Login</Link>
|
|
<Link href="/signup">Signup</Link>
|
|
</>
|
|
)}
|
|
</div>
|
|
</nav>
|
|
);
|
|
}
|