inerito SignOuitButton
This commit is contained in:
parent
2de9d601f5
commit
b006ac7f00
2 changed files with 16 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Inter, JetBrains_Mono } from "next/font/google";
|
import { Inter, JetBrains_Mono } from "next/font/google";
|
||||||
|
import { auth } from "@/src/auth";
|
||||||
|
import SignOutButton from "@/src/components/auth/SignOutButton";
|
||||||
import Navbar from "../components/Navbar";
|
import Navbar from "../components/Navbar";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
|
|
@ -19,18 +21,20 @@ export const metadata: Metadata = {
|
||||||
description: "Generated by create next app",
|
description: "Generated by create next app",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({
|
export default async function RootLayout({
|
||||||
children,
|
children,
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}>) {
|
}>) {
|
||||||
|
const session = await auth();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
|
<body className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
|
||||||
<p className="bg-purple-700 text-white w-full text-center py-2">
|
<p className="bg-purple-700 text-white w-full text-center py-2">
|
||||||
Sono del layout root
|
Sono del layout root
|
||||||
</p>
|
</p>
|
||||||
<Navbar />
|
<Navbar actions={session?.user ? <SignOutButton /> : null} />
|
||||||
{children}
|
{children}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// @version: "1.0.0 2026-05-07"
|
// @version: "1.0.0 2026-05-07"
|
||||||
//====================================
|
//====================================
|
||||||
"use client"
|
"use client"
|
||||||
import { useState , MouseEvent} from "react";
|
import { useState , MouseEvent, ReactNode} from "react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
interface NavLink {
|
interface NavLink {
|
||||||
|
|
@ -34,7 +34,7 @@ const serviceLinks: ServiceLink[] = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar({ actions }: { actions?: ReactNode }) {
|
||||||
|
|
||||||
const [ isServicesOpen, setIsServicesOpen] = useState<boolean>(false);
|
const [ isServicesOpen, setIsServicesOpen] = useState<boolean>(false);
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ export default function Navbar() {
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* Navigation */}
|
{/* Navigation */}
|
||||||
<div className="flex space-x-8">
|
<div className="flex items-center space-x-8">
|
||||||
|
|
||||||
{/* Link normali */}
|
{/* Link normali */}
|
||||||
{navLinks.map((link) => (
|
{navLinks.map((link) => (
|
||||||
|
|
@ -117,8 +117,14 @@ export default function Navbar() {
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{actions ? (
|
||||||
|
<div className="flex items-center">
|
||||||
|
{actions}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue