feat: update layout and components for improved user experience, add theme toggle and main navigation
This commit is contained in:
@@ -1,37 +1,39 @@
|
||||
// components/header.tsx
|
||||
"use client";
|
||||
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import Link from "next/link";
|
||||
import { Button } from "./ui/button";
|
||||
import { UserNav } from "./user-nav";
|
||||
import { MainNav } from "./main-nav";
|
||||
import { ThemeToggle } from "./theme-toggle";
|
||||
import { Wind } from "lucide-react";
|
||||
|
||||
export function Header() {
|
||||
const { token } = useAuth();
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
||||
<div className="container flex h-14 items-center">
|
||||
<div className="mr-4 flex">
|
||||
<Link href="/" className="mr-6 flex items-center space-x-2">
|
||||
<span className="font-bold">Thoughts</span>
|
||||
<div className="w-full flex h-14 items-center px-2">
|
||||
<div className="flex gap-2">
|
||||
<Link href="/" className="flex items-center gap-1">
|
||||
<span className="hidden font-bold sm:inline-block">Thoughts</span>
|
||||
</Link>
|
||||
<MainNav />
|
||||
</div>
|
||||
<div className="flex flex-1 items-center justify-end space-x-4">
|
||||
<nav className="flex items-center space-x-2">
|
||||
{token ? (
|
||||
<UserNav />
|
||||
) : (
|
||||
<>
|
||||
<Button asChild variant="ghost">
|
||||
<Link href="/login">Login</Link>
|
||||
</Button>
|
||||
<Button asChild>
|
||||
<Link href="/register">Register</Link>
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</nav>
|
||||
<div className="flex flex-1 items-center justify-end space-x-2">
|
||||
<ThemeToggle />
|
||||
{token ? (
|
||||
<UserNav />
|
||||
) : (
|
||||
<>
|
||||
<Button asChild variant="ghost" size="sm">
|
||||
<Link href="/login">Login</Link>
|
||||
</Button>
|
||||
<Button asChild size="sm">
|
||||
<Link href="/register">Register</Link>
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
Reference in New Issue
Block a user