-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnavbar.tsx
More file actions
44 lines (41 loc) · 1.37 KB
/
Copy pathnavbar.tsx
File metadata and controls
44 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"use client";
import Image from "next/image";
import Link from "next/link";
import useScroll from "@/lib/hooks/use-scroll";
import { useSignInModal } from "./sign-in-modal";
import UserDropdown from "./user-dropdown";
import { Session } from "next-auth";
export default function NavBar({ session }: { session: Session | null }) {
const { SignInModal, setShowSignInModal } = useSignInModal();
const scrolled = useScroll(50);
return (
<>
<SignInModal />
<div
className={`fixed top-0 flex w-full justify-center ${
scrolled
? "border-b border-gray-200 bg-white/50 backdrop-blur-xl"
: "bg-white/0"
} z-25 transition-all`}
>
<div className="mx-5 flex h-16 w-full max-w-screen-xl items-center justify-between">
<Link href="/" className="font-display flex items-center text-2xl">
<p className="">Catchup</p>
</Link>
<div>
{session ? (
<UserDropdown session={session} />
) : (
<button
className="rounded-full border border-black bg-black p-1.5 px-4 text-sm text-white transition-all hover:bg-white hover:text-black"
onClick={() => setShowSignInModal(true)}
>
Sign In
</button>
)}
</div>
</div>
</div>
</>
);
}