-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add sign up button in site header
- Loading branch information
1 parent
b107e45
commit db7f2ca
Showing
8 changed files
with
56 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use client"; | ||
|
||
import { usePathname } from "next/navigation"; | ||
import { Button } from "@/components/ui/button"; | ||
import Link from "next/link"; | ||
|
||
export const SignButton = async () => { | ||
const pathname = usePathname(); | ||
|
||
if (pathname === "/login") { | ||
return ( | ||
<Link href="/signup"> | ||
<Button variant="outline">Sign Up</Button> | ||
</Link> | ||
); | ||
} else { | ||
return ( | ||
<Link href="/login"> | ||
<Button variant="outline">Login</Button> | ||
</Link> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
import { UserNav } from "./user-nav"; | ||
import { User, getServerSession } from "next-auth"; | ||
import { SignButton } from "./sign-button"; | ||
import { authOptions } from "@/app/api/auth/[...nextauth]/route"; | ||
|
||
export const UserSession = async () => { | ||
const session = await getServerSession(authOptions); | ||
|
||
console.debug("UserSession session", session); | ||
|
||
if (session?.user) { | ||
return <UserNav user={session?.user as User}></UserNav>; | ||
} | ||
return <SignButton />; | ||
}; |