mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 09:48:32 +00:00
FIX #95 login button in initial page
This commit is contained in:
parent
651f984e52
commit
ee5043b591
1 changed files with 24 additions and 9 deletions
|
|
@ -1,10 +1,13 @@
|
|||
import Link from "next/link"
|
||||
import { getServerSession } from "next-auth/next"
|
||||
|
||||
import { marketingConfig } from "@/config/marketing"
|
||||
import { authOptions } from "@/lib/auth"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
import { MainNav } from "@/components/main-nav"
|
||||
import { SiteFooter } from "@/components/site-footer"
|
||||
import { UserAccountNav } from "@/components/user-account-nav"
|
||||
|
||||
interface MarketingLayoutProps {
|
||||
children: React.ReactNode
|
||||
|
|
@ -13,21 +16,33 @@ interface MarketingLayoutProps {
|
|||
export default async function MarketingLayout({
|
||||
children,
|
||||
}: MarketingLayoutProps) {
|
||||
const session = await getServerSession(authOptions)
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<header className="container z-40 bg-background">
|
||||
<div className="flex h-20 items-center justify-between py-6">
|
||||
<MainNav items={marketingConfig.mainNav} />
|
||||
<nav>
|
||||
<Link
|
||||
href="/login"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "secondary", size: "sm" }),
|
||||
"px-4"
|
||||
)}
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
{session?.user ? (
|
||||
<UserAccountNav
|
||||
user={{
|
||||
name: session.user.name,
|
||||
image: session.user.image,
|
||||
email: session.user.email
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Link
|
||||
href="/login"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "secondary", size: "sm" }),
|
||||
"px-4"
|
||||
)}
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
|||
Loading…
Reference in a new issue