Skip to content

Commit d0f53c6

Browse files
committed
feat: add logo to header
1 parent 45df236 commit d0f53c6

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

src/app/layout.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { Metadata } from "next";
22
import { Geist, Geist_Mono } from "next/font/google";
3+
import { headers } from "next/headers";
34
import { Toaster } from "sonner";
45
import { Navbar } from "@/components/navbar";
6+
import { auth } from "@/lib/auth/auth";
57
import "@/lib/api-client";
68
import "./globals.css";
79

@@ -20,17 +22,21 @@ export const metadata: Metadata = {
2022
description: "Generated by create next app",
2123
};
2224

23-
export default function RootLayout({
25+
export default async function RootLayout({
2426
children,
2527
}: Readonly<{
2628
children: React.ReactNode;
2729
}>) {
30+
const session = await auth.api.getSession({
31+
headers: await headers(),
32+
});
33+
2834
return (
2935
<html lang="en">
3036
<body
3137
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
3238
>
33-
<Navbar />
39+
{session && <Navbar />}
3440
{children}
3541
<Toaster
3642
richColors

src/components/navbar-logo.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Image from "next/image";
2+
3+
export function NavbarLogo() {
4+
return (
5+
<div className="flex items-center gap-2">
6+
<Image
7+
src="/toolhive-icon.svg"
8+
alt="Toolhive"
9+
width={17}
10+
height={19}
11+
className="shrink-0"
12+
/>
13+
<span className="text-[28px] font-bold leading-[37px] tracking-[-0.025em] text-foreground">
14+
Toolhive
15+
</span>
16+
</div>
17+
);
18+
}

src/components/navbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { headers } from "next/headers";
2+
import { NavbarLogo } from "@/components/navbar-logo";
23
import { UserMenu } from "@/components/user-menu";
34
import { auth } from "@/lib/auth/auth";
45

@@ -10,7 +11,7 @@ export async function Navbar() {
1011
return (
1112
<header className="w-full border-b bg-muted/50">
1213
<div className="container mx-auto flex items-center justify-between px-4 py-4">
13-
<div />
14+
<NavbarLogo />
1415
{session?.user?.name && <UserMenu userName={session.user.name} />}
1516
</div>
1617
</header>

0 commit comments

Comments
 (0)